diff options
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 |