Merge branch 'fix_launcher_paths' into 'master'

Save original paths in launcher (#7246)

Closes #7246

See merge request OpenMW/openmw!2847
depth-refraction
psi29a 2 years ago
commit 2a50212f87

@ -9,6 +9,7 @@
#include <algorithm>
#include <mutex>
#include <thread>
#include <unordered_set>
#include <apps/launcher/utils/cellnameloader.hpp>
@ -230,21 +231,22 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
if (!globalDataDir.empty())
directories.insert(0, Files::pathToQString(globalDataDir));
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
for (auto& currentDir : directories)
currentDir = QDir(QDir::cleanPath(currentDir)).canonicalPath();
// add directories, archives and content files
directories.removeDuplicates();
for (const auto& currentDir : directories)
std::unordered_set<QString> visitedDirectories;
for (const QString& 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
addArchivesFromDir(currentDir);
QString tooltip;
// add content files presents in current directory
mSelector->addFiles(currentDir, mNewDataDirs.contains(currentDir));
mSelector->addFiles(currentDir, mNewDataDirs.contains(canonicalDirPath));
// add current directory to list
ui.directoryListWidget->addItem(currentDir);
@ -252,7 +254,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
auto* item = ui.directoryListWidget->item(row);
// Display new content with green background
if (mNewDataDirs.contains(currentDir))
if (mNewDataDirs.contains(canonicalDirPath))
{
tooltip += "Will be added to the current profile\n";
item->setBackground(Qt::green);

Loading…
Cancel
Save