1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 22:45:36 +00:00

There's no such thing as the global data directory

That's what resources/vfs is for.
This commit is contained in:
AnyOldName3 2024-02-27 14:11:48 +00:00
parent 7d28788aee
commit f476301670
6 changed files with 14 additions and 21 deletions

View file

@ -279,9 +279,9 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
if (!mDataLocal.isEmpty()) if (!mDataLocal.isEmpty())
directories.insert(0, mDataLocal); directories.insert(0, mDataLocal);
const auto& globalDataDir = mGameSettings.getGlobalDataDir(); const auto& resourcesVfs = mGameSettings.getResourcesVfs();
if (!globalDataDir.empty()) if (!resourcesVfs.isEmpty())
directories.insert(0, Files::pathToQString(globalDataDir)); directories.insert(0, resourcesVfs);
std::unordered_set<QString> visitedDirectories; std::unordered_set<QString> visitedDirectories;
for (const QString& currentDir : directories) for (const QString& currentDir : directories)
@ -315,8 +315,8 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
item->setFont(font); item->setFont(font);
} }
// deactivate data-local and global data directory: they are always included // deactivate data-local and resources/vfs: they are always included
if (currentDir == mDataLocal || Files::pathFromQString(currentDir) == globalDataDir) if (currentDir == mDataLocal || currentDir == resourcesVfs)
{ {
auto flags = item->flags(); auto flags = item->flags();
item->setFlags(flags & ~(Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled)); item->setFlags(flags & ~(Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled));

View file

@ -64,13 +64,11 @@ void Config::GameSettings::validatePaths()
} }
} }
std::filesystem::path Config::GameSettings::getGlobalDataDir() const QString Config::GameSettings::getResourcesVfs() const
{ {
// global data dir may not exists if OpenMW is not installed (ie if run from build directory) QString resources = mSettings.value(QString("resources"), QString("./resources"));
const auto& path = mCfgMgr.getGlobalDataPath(); resources += "/vfs";
if (std::filesystem::exists(path)) return QFileInfo(resources).canonicalFilePath();
return std::filesystem::canonical(path);
return {};
} }
QStringList Config::GameSettings::values(const QString& key, const QStringList& defaultValues) const QStringList Config::GameSettings::values(const QString& key, const QStringList& defaultValues) const

View file

@ -53,7 +53,8 @@ namespace Config
} }
QStringList getDataDirs() const; QStringList getDataDirs() const;
std::filesystem::path getGlobalDataDir() const;
QString getResourcesVfs() const;
inline void removeDataDir(const QString& dir) inline void removeDataDir(const QString& dir)
{ {

View file

@ -233,10 +233,10 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings)
return; return;
} }
// global and local data directories are not part of any profile // local data directory and resources/vfs are not part of any profile
const auto globalDataDir = Files::pathToQString(gameSettings.getGlobalDataDir()); const auto resourcesVfs = gameSettings.getResourcesVfs();
const auto dataLocal = gameSettings.getDataLocal(); const auto dataLocal = gameSettings.getDataLocal();
dirs.removeAll(globalDataDir); dirs.removeAll(resourcesVfs);
dirs.removeAll(dataLocal); dirs.removeAll(dataLocal);
// if any existing profile in launcher matches the content list, make that profile the default // if any existing profile in launcher matches the content list, make that profile the default

View file

@ -411,11 +411,6 @@ namespace Files
return mFixedPath.getLocalPath(); return mFixedPath.getLocalPath();
} }
const std::filesystem::path& ConfigurationManager::getGlobalDataPath() const
{
return mFixedPath.getGlobalDataPath();
}
const std::filesystem::path& ConfigurationManager::getCachePath() const const std::filesystem::path& ConfigurationManager::getCachePath() const
{ {
return mFixedPath.getCachePath(); return mFixedPath.getCachePath();

View file

@ -45,7 +45,6 @@ namespace Files
const std::filesystem::path& getGlobalPath() const; const std::filesystem::path& getGlobalPath() const;
const std::filesystem::path& getLocalPath() const; const std::filesystem::path& getLocalPath() const;
const std::filesystem::path& getGlobalDataPath() const;
const std::filesystem::path& getUserConfigPath() const; const std::filesystem::path& getUserConfigPath() const;
const std::filesystem::path& getUserDataPath() const; const std::filesystem::path& getUserDataPath() const;
const std::filesystem::path& getLocalDataPath() const; const std::filesystem::path& getLocalDataPath() const;