refactor(audit): unify config-dir resolution through Platform::getConfigDir
Settings::getDefaultPath and AddressBook::getDefaultPath each hand-rolled the same per-platform #ifdef (Win SHGetFolderPath / macOS Application Support / XDG ~/.config) with the DRAGONX_APP_NAME variant suffix. Route both through util::Platform::getConfigDir() instead — one place owns the split — and add the missing __APPLE__ branch to getConfigDir so it too returns the macOS-native ~/Library/Application Support/<AppName>. This also fixes a latent macOS inconsistency: transaction_history_cache already resolves via getConfigDir(), which lacked the __APPLE__ branch, so on macOS the tx cache landed in ~/.config while settings/addressbook went to ~/Library/Application Support. Now all three agree. No migration needed: Linux/Windows paths are unchanged, and macOS packaging is not yet shipped. Removes ~50 lines of duplicated #ifdef. Full-node + Lite build clean; ctest 1/1; hygiene clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -245,6 +245,9 @@ std::string Platform::getConfigDir()
|
||||
return std::string(path) + "\\" DRAGONX_APP_NAME "\\";
|
||||
}
|
||||
return getHomeDir() + "\\AppData\\Roaming\\" DRAGONX_APP_NAME "\\";
|
||||
#elif defined(__APPLE__)
|
||||
// macOS-native config location (matches what settings.json / addressbook.json use).
|
||||
return getHomeDir() + "/Library/Application Support/" DRAGONX_APP_NAME "/";
|
||||
#else
|
||||
return getHomeDir() + "/.config/" DRAGONX_APP_NAME "/";
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user