Compare commits

...

2 commits

Author SHA1 Message Date
BearOso
d514d135a7 Gtk: Create config directory in get_config_dir if it doesn't exist. 2024-06-18 15:38:21 -05:00
BearOso
ed3695f704 Gtk: Fix config directory order.
Search for XDG_CONFIG_HOME. If that exists, use
$XDG_CONFIG_HOME/snes9x, otherwise use $HOME/.config/snes9x.

Remove broken legacy check.
2024-06-18 15:35:05 -05:00

View file

@ -33,22 +33,21 @@ std::string get_config_dir()
return std::string{".snes9x"}; return std::string{".snes9x"};
} }
fs::path config = env_home; fs::path config;
fs::path legacy = config;
// If XDG_CONFIG_HOME is set, use that, otherwise guess default // If XDG_CONFIG_HOME is set, use that, otherwise guess default
if (!env_xdg_config_home) if (env_xdg_config_home)
{
config /= ".config/snes9x";
legacy /= ".snes9x";
}
else
{ {
config = env_xdg_config_home; config = env_xdg_config_home;
config /= "snes9x"; config /= "snes9x";
} }
if (fs::exists(legacy) && !fs::exists(config)) else
return legacy; {
config = env_home;
config /= ".config/snes9x";
}
if (!fs::exists(config))
fs::create_directories(config);
return config; return config;
} }