diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/function/GlobalSettingStation.cpp | 41 | ||||
-rw-r--r-- | src/core/function/GlobalSettingStation.h | 7 |
2 files changed, 23 insertions, 25 deletions
diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp index be500907..e3970a6a 100644 --- a/src/core/function/GlobalSettingStation.cpp +++ b/src/core/function/GlobalSettingStation.cpp @@ -44,6 +44,21 @@ class GlobalSettingStation::Impl { */ explicit Impl() noexcept { SPDLOG_INFO("app path: {}", app_path_.u8string()); + auto protable_file_path = app_path_ / "PORTABLE.txt"; + if (std::filesystem::exists(protable_file_path)) { + SPDLOG_INFO( + "dectected protable mode, reconfiguring config and data path..."); + + app_configure_path_ = app_path_.parent_path(); + config_dir_path_ = app_configure_path_ / "conf"; + main_config_path_ = config_dir_path_ / "main.cfg"; + module_config_path_ = config_dir_path_ / "module.cfg"; + + app_data_path_ = app_path_.parent_path(); + app_log_path_ = app_data_path_ / "logs"; + app_data_objs_path_ = app_data_path_ / "data_objs"; + } + SPDLOG_INFO("app configure path: {}", app_configure_path_.u8string()); SPDLOG_INFO("app data path: {}", app_data_path_.u8string()); SPDLOG_INFO("app log path: {}", app_log_path_.u8string()); @@ -163,15 +178,6 @@ class GlobalSettingStation::Impl { } /** - * @brief Get the Standalone Gpg Bin Dir object - * - * @return std::filesystem::path - */ - [[nodiscard]] auto GetStandaloneGpgBinDir() const -> std::filesystem::path { - return app_resource_path_ / "gpg1.4" / "gpg"; - } - - /** * @brief Get the Locale Dir object * * @return std::filesystem::path @@ -220,8 +226,10 @@ class GlobalSettingStation::Impl { .parent_path(); std::filesystem::path app_data_path_ = - QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) - .toStdString(); ///< Program Data Location + std::filesystem::path{ + QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + .toStdString()} / + "GpgFrontend"; ///< Program Data Location std::filesystem::path app_log_path_ = app_data_path_ / "logs"; ///< Program Data Location @@ -247,8 +255,10 @@ class GlobalSettingStation::Impl { #endif std::filesystem::path app_configure_path_ = - QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) - .toStdString(); ///< Program Configure Location + std::filesystem::path{ + QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + .toStdString()} / + "GpgFrontend"; ///< Program Configure Location std::filesystem::path config_dir_path_ = app_configure_path_ / "conf"; ///< Configure File Directory Location std::filesystem::path main_config_path_ = @@ -299,11 +309,6 @@ auto GlobalSettingStation::GetAppConfigPath() const -> std::filesystem::path { return p_->GetAppConfigPath(); } -auto GlobalSettingStation::GetStandaloneGpgBinDir() const - -> std::filesystem::path { - return p_->GetStandaloneGpgBinDir(); -} - auto GlobalSettingStation::GetLocaleDir() const -> std::filesystem::path { return p_->GetLocaleDir(); } diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index cb3b4700..282e115d 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -99,13 +99,6 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation [[nodiscard]] auto GetAppConfigPath() const -> std::filesystem::path; /** - * @brief Get the Standalone Gpg Bin Dir object - * - * @return std::filesystem::path - */ - [[nodiscard]] auto GetStandaloneGpgBinDir() const -> std::filesystem::path; - - /** * @brief Get the Locale Dir object * * @return std::filesystem::path |