diff options
author | saturneric <[email protected]> | 2025-02-03 18:01:26 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-02-03 18:01:26 +0000 |
commit | d3d94f5b7a3e60b3bbb73e832bab7cf2d44a1600 (patch) | |
tree | 5cc7838f1325b076b91bb898fd0da3cfcb60b455 /src/core/function/GlobalSettingStation.cpp | |
parent | doc: update README.md (diff) | |
parent | fix: set pb range when size of operas > 1 (diff) | |
download | GpgFrontend-d3d94f5b7a3e60b3bbb73e832bab7cf2d44a1600.tar.gz GpgFrontend-d3d94f5b7a3e60b3bbb73e832bab7cf2d44a1600.zip |
Merge branch 'develop'
Diffstat (limited to 'src/core/function/GlobalSettingStation.cpp')
-rw-r--r-- | src/core/function/GlobalSettingStation.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp index 4c88fde4..62b24331 100644 --- a/src/core/function/GlobalSettingStation.cpp +++ b/src/core/function/GlobalSettingStation.cpp @@ -48,7 +48,7 @@ class GlobalSettingStation::Impl { Module::UpsertRTValue("core", "env.state.portable", 1); LOG_I() << "GpgFrontend runs in the portable mode now"; - app_data_path_ = app_path_ + "/../"; + app_data_path_ = QDir(app_path_ + "/../").canonicalPath(); app_config_path_ = app_data_path_ + "/config"; portable_mode_ = true; @@ -61,6 +61,11 @@ class GlobalSettingStation::Impl { #if defined(_WIN32) || defined(WIN32) LOG_I() << "app config path: " << app_config_path_; if (!QDir(app_config_path_).exists()) QDir(app_config_path_).mkpath("."); +#else + if (IsProtableMode()) { + LOG_I() << "app config path: " << app_config_path_; + if (!QDir(app_config_path_).exists()) QDir(app_config_path_).mkpath("."); + } #endif if (!QDir(app_data_path_).exists()) QDir(app_data_path_).mkpath("."); @@ -74,6 +79,7 @@ class GlobalSettingStation::Impl { #if defined(_WIN32) || defined(WIN32) return QSettings(app_config_file_path(), QSettings::IniFormat); #else + if (IsProtableMode()) return {app_config_file_path(), QSettings::IniFormat}; return QSettings(); #endif } @@ -171,6 +177,8 @@ class GlobalSettingStation::Impl { return exec_binary_path + "/modules"; } + [[nodiscard]] auto IsProtableMode() const -> bool { return portable_mode_; } + private: [[nodiscard]] auto app_config_file_path() const -> QString { return app_config_path_ + "/config.ini"; @@ -244,4 +252,11 @@ auto GlobalSettingStation::GetConfigPath() const -> QString { auto GlobalSettingStation::GetIntegratedModulePath() const -> QString { return p_->GetIntegratedModulePath(); } + +auto GlobalSettingStation::IsProtableMode() const -> bool { + return p_->IsProtableMode(); +} +auto GetSettings() -> QSettings { + return GlobalSettingStation::GetInstance().GetSettings(); +} } // namespace GpgFrontend
\ No newline at end of file |