Change where the config dir is created.

On Windows, if there is a `vbam.ini` where the exe is, we should not
create the configuration directory `%LOCALAPPDATA%\visualboyadvance-m`.
This commit is contained in:
Edênis Freindorfer Azevedo 2019-05-30 20:34:37 -03:00 committed by Rafael Kitover
parent 3490620e0f
commit bf6f2d4ac2
1 changed files with 6 additions and 12 deletions

View File

@ -659,6 +659,12 @@ const char* FindConfigFile(const char *name)
return name;
}
struct stat s;
std::string homeDirTmp = get_xdg_user_config_home() + DOT_DIR;
homeDir = (char *)homeDirTmp.c_str();
if (stat(homeDir, &s) == -1 || !S_ISDIR(s.st_mode))
mkdir(homeDir, 0755);
if (homeDir) {
sprintf(path, "%s%c%s", homeDir, FILE_SEP, name);
if (FileExists(path))
@ -730,12 +736,6 @@ const char* FindConfigFile(const char *name)
void LoadConfigFile()
{
struct stat s;
std::string homeDirTmp = get_xdg_user_config_home() + DOT_DIR;
homeDir = (char *)homeDirTmp.c_str();
if (stat(homeDir, &s) == -1 || !S_ISDIR(s.st_mode))
mkdir(homeDir, 0755);
if (preferences == NULL)
{
const char* configFile = FindConfigFile("vbam.ini");
@ -745,12 +745,6 @@ void LoadConfigFile()
void SaveConfigFile()
{
struct stat s;
std::string homeDirTmp = get_xdg_user_config_home() + DOT_DIR;
homeDir = (char *)homeDirTmp.c_str();
if (stat(homeDir, &s) == -1 || !S_ISDIR(s.st_mode))
mkdir(homeDir, 0755);
const char* configFile = FindConfigFile("vbam.ini");
if (configFile != NULL)