From 3b94eecde250a1cff774dd66e9c9730f223fe72b Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Mon, 10 Aug 2020 23:41:59 +0800 Subject: [PATCH] chore: only enable portable mode support for windows --- CMakeLists.txt | 4 ++++ settings.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cd978a..e50649f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,10 @@ if (WIN32) TARGET ${EXE_NAME} PROPERTY WIN32_EXECUTABLE true ) + + target_compile_definitions(${EXE_NAME} PRIVATE + FLAG_PORTABLE_MODE_SUPPORT=1 + ) endif () # Helper macros for install settings diff --git a/settings.cpp b/settings.cpp index 861af74..f7f9922 100644 --- a/settings.cpp +++ b/settings.cpp @@ -67,12 +67,14 @@ Settings::Settings() { QString configPath; +#ifdef FLAG_PORTABLE_MODE_SUPPORT QString portableConfigDirPath = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("data"); QFileInfo portableConfigDirInfo(portableConfigDirPath); if (portableConfigDirInfo.exists() && portableConfigDirInfo.isDir() && portableConfigDirInfo.isWritable()) { // we can use it. configPath = portableConfigDirPath; } +#endif // FLAG_PORTABLE_MODE_SUPPORT // %LOCALAPPDATA% under Windows. if (configPath.isEmpty()) {