For QT GUI added logic to check for an FCEUX_CONFIG_DIR environment variable to specify the folder where fceux data resides. This allows users to specify there own data folder that doesn't have a .fceux hidden folder get auto created.

This commit is contained in:
harry 2023-01-14 18:34:03 -05:00
parent 90d03a6374
commit c837c8981c
1 changed files with 10 additions and 3 deletions

View File

@ -432,7 +432,8 @@ CreateDirs(const std::string &dir)
static void
GetBaseDirectory(std::string &dir)
{
char *home = getenv("FCEUX_HOME");
const char *home = getenv("FCEUX_HOME");
const char *conf = getenv("FCEUX_CONFIG_DIR");
#ifdef WIN32
// Windows users want base directory to be where executable resides.
@ -453,10 +454,16 @@ GetBaseDirectory(std::string &dir)
}
#endif
if (home)
if (conf)
{
dir = std::string(conf);
}
else if (home)
{
dir = std::string(home) + "/.fceux";
} else {
}
else
{
#ifdef WIN32
home = new char[MAX_PATH + 1];
GetModuleFileNameA(NULL, home, MAX_PATH + 1);