mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-29 00:06:41 +00:00
Save original paths
If directory path is a symlink it should be showed and written to config files as is. Between launcher runs the resulting canonical path may be different so the resolved path becomes outdated.
This commit is contained in:
parent
9f00b99b22
commit
80387049c1
1 changed files with 6 additions and 7 deletions
|
@ -236,14 +236,13 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||
if (!globalDataDir.isEmpty())
|
||||
directories.insert(0, globalDataDir);
|
||||
|
||||
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
|
||||
for (auto& currentDir : directories)
|
||||
currentDir = QDir(QDir::cleanPath(currentDir)).canonicalPath();
|
||||
|
||||
std::unordered_set<QString> visitedDirectories;
|
||||
for (const QString& currentDir : directories)
|
||||
{
|
||||
if (!visitedDirectories.insert(currentDir).second)
|
||||
// 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
|
||||
|
@ -252,7 +251,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||
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);
|
||||
|
@ -260,7 +259,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…
Reference in a new issue