1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 15:45:33 +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())
directories.insert(0, mDataLocal);
const auto& globalDataDir = mGameSettings.getGlobalDataDir();
if (!globalDataDir.empty())
directories.insert(0, Files::pathToQString(globalDataDir));
const auto& resourcesVfs = mGameSettings.getResourcesVfs();
if (!resourcesVfs.isEmpty())
directories.insert(0, resourcesVfs);
std::unordered_set<QString> visitedDirectories;
for (const QString& currentDir : directories)
@ -315,8 +315,8 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
item->setFont(font);
}
// deactivate data-local and global data directory: they are always included
if (currentDir == mDataLocal || Files::pathFromQString(currentDir) == globalDataDir)
// deactivate data-local and resources/vfs: they are always included
if (currentDir == mDataLocal || currentDir == resourcesVfs)
{
auto flags = item->flags();
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)
const auto& path = mCfgMgr.getGlobalDataPath();
if (std::filesystem::exists(path))
return std::filesystem::canonical(path);
return {};
QString resources = mSettings.value(QString("resources"), QString("./resources"));
resources += "/vfs";
return QFileInfo(resources).canonicalFilePath();
}
QStringList Config::GameSettings::values(const QString& key, const QStringList& defaultValues) const

View file

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

View file

@ -233,10 +233,10 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings)
return;
}
// global and local data directories are not part of any profile
const auto globalDataDir = Files::pathToQString(gameSettings.getGlobalDataDir());
// local data directory and resources/vfs are not part of any profile
const auto resourcesVfs = gameSettings.getResourcesVfs();
const auto dataLocal = gameSettings.getDataLocal();
dirs.removeAll(globalDataDir);
dirs.removeAll(resourcesVfs);
dirs.removeAll(dataLocal);
// 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();
}
const std::filesystem::path& ConfigurationManager::getGlobalDataPath() const
{
return mFixedPath.getGlobalDataPath();
}
const std::filesystem::path& ConfigurationManager::getCachePath() const
{
return mFixedPath.getCachePath();

View file

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