diff options
| author | Ezekiel Smith <ezekielsmith@protonmail.com> | 2022-03-02 00:03:31 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-02 00:03:31 +1100 |
| commit | e1f28be15128175467e8a44e9556223963fb56c1 (patch) | |
| tree | 3c5c6367cc585266d9201a5f2aea951f237cc0b4 /launcher | |
| parent | 139ff82432897e68bddab9ed8e9aec89c174d0fe (diff) | |
| parent | 5d1ca33b84afee9f09093c27f2eff525325d08cb (diff) | |
| download | PrismLauncher-e1f28be15128175467e8a44e9556223963fb56c1.tar.gz PrismLauncher-e1f28be15128175467e8a44e9556223963fb56c1.tar.bz2 PrismLauncher-e1f28be15128175467e8a44e9556223963fb56c1.zip | |
Merge pull request #163 from txtsd/windows_data_dir
Replace build layouts with Launcher_PORTABLE cmake flag
Diffstat (limited to 'launcher')
| -rw-r--r-- | launcher/Application.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp index e33df252..0ce80d4b 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -294,16 +294,20 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) } else { -#ifdef LAUNCHER_LINUX_DATADIR - QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); - if (xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); - dataPath = xdgDataHome + "/polymc"; - adjustedBy += "XDG standard " + dataPath; -#elif defined(Q_OS_MAC) +#if !defined(LAUNCHER_PORTABLE) || defined(Q_OS_MAC) QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); dataPath = foo.absolutePath(); - adjustedBy += "Fallback to special Mac location " + dataPath; + adjustedBy += dataPath; + +#ifdef Q_OS_LINUX + // TODO: this should be removed in a future version + // TODO: provide a migration path similar to macOS migration + QDir bar(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation), "polymc")); + if (bar.exists()) { + dataPath = bar.absolutePath(); + adjustedBy += "Legacy data path " + dataPath; + } +#endif #else dataPath = applicationDirPath(); adjustedBy += "Fallback to binary path " + dataPath; @@ -505,8 +509,10 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) #elif defined(Q_OS_WIN32) m_rootPath = binPath; #elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation), "..")); + QDir foo(FS::PathCombine(binPath, "../..")); m_rootPath = foo.absolutePath(); + // on macOS, touch the root to force Finder to reload the .app metadata (and fix any icon change issues) + FS::updateTimestamp(m_rootPath); #endif #ifdef MULTIMC_JARS_LOCATION |
