fix(lite): give the lite variant its own config folder (ObsidianDragonLite)

Both variants hardcoded "ObsidianDragon" as the per-user config folder
(settings.json, themes, the lite_rollout cache), so the lite app and the
full-node app shared one settings.json. That cross-variant pollution can leave
the lite server selection in a bad state — and since openWallet() contacts the
selected lightwalletd server, a wrong/empty server URL there makes an existing
wallet fail to open (a silent "disconnected" spinner).

Use DRAGONX_APP_NAME (already "ObsidianDragon" / "ObsidianDragonLite" per variant)
for the config-dir name in Settings::getDefaultPath, Platform::getConfigDir and
getObsidianDragonDir (and the theme-setup exe-name probe). Full-node is unchanged;
lite now reads/writes %APPDATA%\ObsidianDragonLite (and ~/.config/ObsidianDragonLite),
so it starts from a clean, isolated config and uses default servers.

Note: the lite wallet file itself lives in the litelib backend's own data dir
(unaffected); this isolates the GUI config only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 16:06:12 -05:00
parent 6531d0c4d2
commit 79e5adcbd3
2 changed files with 14 additions and 13 deletions

View File

@@ -64,7 +64,7 @@ std::string Settings::getDefaultPath()
#ifdef _WIN32 #ifdef _WIN32
char path[MAX_PATH]; char path[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, path))) { if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, path))) {
std::string dir = std::string(path) + "\\ObsidianDragon"; std::string dir = std::string(path) + "\\" DRAGONX_APP_NAME;
fs::create_directories(dir); fs::create_directories(dir);
return dir + "\\settings.json"; return dir + "\\settings.json";
} }
@@ -75,7 +75,7 @@ std::string Settings::getDefaultPath()
struct passwd* pw = getpwuid(getuid()); struct passwd* pw = getpwuid(getuid());
home = pw->pw_dir; home = pw->pw_dir;
} }
std::string dir = std::string(home) + "/Library/Application Support/ObsidianDragon"; std::string dir = std::string(home) + "/Library/Application Support/" DRAGONX_APP_NAME;
fs::create_directories(dir); fs::create_directories(dir);
return dir + "/settings.json"; return dir + "/settings.json";
#else #else
@@ -84,7 +84,7 @@ std::string Settings::getDefaultPath()
struct passwd* pw = getpwuid(getuid()); struct passwd* pw = getpwuid(getuid());
home = pw->pw_dir; home = pw->pw_dir;
} }
std::string dir = std::string(home) + "/.config/ObsidianDragon"; std::string dir = std::string(home) + "/.config/" DRAGONX_APP_NAME;
fs::create_directories(dir); fs::create_directories(dir);
return dir + "/settings.json"; return dir + "/settings.json";
#endif #endif

View File

@@ -44,6 +44,7 @@
#endif #endif
#include "../util/logger.h" #include "../util/logger.h"
#include "../config/version.h" // DRAGONX_APP_NAME — variant-specific config folder name
#ifndef _WIN32 #ifndef _WIN32
extern char **environ; extern char **environ;
@@ -223,11 +224,11 @@ std::string Platform::getConfigDir()
#ifdef _WIN32 #ifdef _WIN32
char path[MAX_PATH]; char path[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_APPDATA, nullptr, 0, path))) { if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_APPDATA, nullptr, 0, path))) {
return std::string(path) + "\\ObsidianDragon\\"; return std::string(path) + "\\" DRAGONX_APP_NAME "\\";
} }
return getHomeDir() + "\\AppData\\Roaming\\ObsidianDragon\\"; return getHomeDir() + "\\AppData\\Roaming\\" DRAGONX_APP_NAME "\\";
#else #else
return getHomeDir() + "/.config/ObsidianDragon/"; return getHomeDir() + "/.config/" DRAGONX_APP_NAME "/";
#endif #endif
} }
@@ -370,17 +371,17 @@ std::string Platform::getObsidianDragonDir()
#ifdef _WIN32 #ifdef _WIN32
const char* appdata = std::getenv("APPDATA"); const char* appdata = std::getenv("APPDATA");
if (appdata) { if (appdata) {
return (std::filesystem::path(appdata) / "ObsidianDragon").string(); return (std::filesystem::path(appdata) / DRAGONX_APP_NAME).string();
} }
return (std::filesystem::path(getHomeDir()) / "AppData" / "Roaming" / "ObsidianDragon").string(); return (std::filesystem::path(getHomeDir()) / "AppData" / "Roaming" / DRAGONX_APP_NAME).string();
#elif defined(__APPLE__) #elif defined(__APPLE__)
return (std::filesystem::path(getHomeDir()) / "Library" / "Application Support" / "ObsidianDragon").string(); return (std::filesystem::path(getHomeDir()) / "Library" / "Application Support" / DRAGONX_APP_NAME).string();
#else #else
const char* xdg_config = std::getenv("XDG_CONFIG_HOME"); const char* xdg_config = std::getenv("XDG_CONFIG_HOME");
if (xdg_config) { if (xdg_config) {
return (std::filesystem::path(xdg_config) / "ObsidianDragon").string(); return (std::filesystem::path(xdg_config) / DRAGONX_APP_NAME).string();
} }
return (std::filesystem::path(getHomeDir()) / ".config" / "ObsidianDragon").string(); return (std::filesystem::path(getHomeDir()) / ".config" / DRAGONX_APP_NAME).string();
#endif #endif
} }
@@ -414,9 +415,9 @@ void Platform::ensureObsidianDragonSetup()
// Regenerate if the running binary is newer than the example file // Regenerate if the running binary is newer than the example file
fs::path exePath = fs::path(getExecutableDirectory()) / fs::path exePath = fs::path(getExecutableDirectory()) /
#ifdef _WIN32 #ifdef _WIN32
"ObsidianDragon.exe"; DRAGONX_APP_NAME ".exe";
#else #else
"ObsidianDragon"; DRAGONX_APP_NAME;
#endif #endif
std::error_code tec; std::error_code tec;
auto exeTime = fs::last_write_time(exePath, tec); auto exeTime = fs::last_write_time(exePath, tec);