win: check APPDATA if LOCALAPPDATA is not found
Check for the APPDATA environment variable if there is no LOCALAPPDATA environment variable for things like reading the config file. Fix #407. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
32fbfec46c
commit
0f2c8cab08
|
@ -75,7 +75,9 @@ std::string get_xdg_user_config_home()
|
|||
std::string home(getenv("HOME"));
|
||||
path = home + "/Library/Application Support";
|
||||
#elif _WIN32
|
||||
std::string app_data(getenv("LOCALAPPDATA"));
|
||||
char *app_data_env = getenv("LOCALAPPDATA");
|
||||
if (!app_data_env) app_data_env = getenv("APPDATA");
|
||||
std::string app_data(app_data_env);
|
||||
path = app_data;
|
||||
#else // Unix
|
||||
char *xdg_var = getenv("XDG_CONFIG_HOME");
|
||||
|
@ -103,7 +105,9 @@ std::string get_xdg_user_data_home()
|
|||
std::string home(getenv("HOME"));
|
||||
path = home + "/Library/Application Support";
|
||||
#elif _WIN32
|
||||
std::string app_data(getenv("LOCALAPPDATA"));
|
||||
char *app_data_env = getenv("LOCALAPPDATA");
|
||||
if (!app_data_env) app_data_env = getenv("APPDATA");
|
||||
std::string app_data(app_data_env);
|
||||
path = app_data;
|
||||
#else // Unix
|
||||
char *xdg_var = getenv("XDG_DATA_HOME");
|
||||
|
|
Loading…
Reference in New Issue