From 15664982dd1131599402da22b79250b0b1d85dc0 Mon Sep 17 00:00:00 2001 From: routersys Date: Thu, 10 Sep 2026 11:03:20 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=85=88=E3=81=AE=E5=8C=BA?= =?UTF-8?q?=E5=88=87=E3=82=8A=E3=81=8C=E9=87=8D=E3=81=AA=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E7=9B=B4=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Settings.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Settings.cpp b/src/Settings.cpp index a486bf8..410182a 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -18,9 +18,14 @@ bool g_loaded = false; const wchar_t* kSection = L"ProxyEdit"; +std::wstring Trimmed(std::wstring path) { + while (!path.empty() && (path.back() == L'\\' || path.back() == L'/')) path.pop_back(); + return path; +} + std::wstring AppDataPath() { CONFIG_HANDLE* config = Config(); - if (config && config->app_data_path) return std::wstring(config->app_data_path); + if (config && config->app_data_path) return Trimmed(config->app_data_path); wchar_t buffer[MAX_PATH]; if (SHGetSpecialFolderPathW(nullptr, buffer, CSIDL_COMMON_APPDATA, FALSE)) { std::wstring path(buffer); @@ -116,7 +121,7 @@ std::wstring DefaultStorePath() { std::wstring EffectiveStorePath() { const Settings& settings = CurrentSettings(); - if (!settings.store_path.empty()) return settings.store_path; + if (!settings.store_path.empty()) return Trimmed(settings.store_path); return DefaultStorePath(); }