mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 13:23:53 +00:00
Merge branch 'fix_launcher_paths_48' into 'openmw-48'
Save original paths in launcher (#7246) for 0.48 See merge request OpenMW/openmw!2849
This commit is contained in:
commit
64ca3e71bb
1 changed files with 11 additions and 9 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
#include <apps/launcher/utils/cellnameloader.hpp>
|
#include <apps/launcher/utils/cellnameloader.hpp>
|
||||||
|
|
||||||
|
@ -235,21 +236,22 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
if (!globalDataDir.isEmpty())
|
if (!globalDataDir.isEmpty())
|
||||||
directories.insert(0, globalDataDir);
|
directories.insert(0, globalDataDir);
|
||||||
|
|
||||||
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
|
std::unordered_set<QString> visitedDirectories;
|
||||||
for (auto& currentDir : directories)
|
for (const QString& currentDir : directories)
|
||||||
currentDir = QDir(QDir::cleanPath(currentDir)).canonicalPath();
|
|
||||||
|
|
||||||
// add directories, archives and content files
|
|
||||||
directories.removeDuplicates();
|
|
||||||
for (const auto& currentDir : directories)
|
|
||||||
{
|
{
|
||||||
|
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
|
||||||
|
const QString canonicalDirPath = QDir(QDir::cleanPath(currentDir)).canonicalPath();
|
||||||
|
|
||||||
|
if (!visitedDirectories.insert(canonicalDirPath).second)
|
||||||
|
continue;
|
||||||
|
|
||||||
// add new achives files presents in current directory
|
// add new achives files presents in current directory
|
||||||
addArchivesFromDir(currentDir);
|
addArchivesFromDir(currentDir);
|
||||||
|
|
||||||
QString tooltip;
|
QString tooltip;
|
||||||
|
|
||||||
// add content files presents in current directory
|
// add content files presents in current directory
|
||||||
mSelector->addFiles(currentDir, mNewDataDirs.contains(currentDir));
|
mSelector->addFiles(currentDir, mNewDataDirs.contains(canonicalDirPath));
|
||||||
|
|
||||||
// add current directory to list
|
// add current directory to list
|
||||||
ui.directoryListWidget->addItem(currentDir);
|
ui.directoryListWidget->addItem(currentDir);
|
||||||
|
@ -257,7 +259,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
auto* item = ui.directoryListWidget->item(row);
|
auto* item = ui.directoryListWidget->item(row);
|
||||||
|
|
||||||
// Display new content with green background
|
// Display new content with green background
|
||||||
if (mNewDataDirs.contains(currentDir))
|
if (mNewDataDirs.contains(canonicalDirPath))
|
||||||
{
|
{
|
||||||
tooltip += "Will be added to the current profile\n";
|
tooltip += "Will be added to the current profile\n";
|
||||||
item->setBackground(Qt::green);
|
item->setBackground(Qt::green);
|
||||||
|
|
Loading…
Reference in a new issue