GTK: Don't change config directory mode every time.

This triggers something laggy in GNOME environment.
This commit is contained in:
Brandon Wright 2019-10-10 18:42:50 -05:00
parent f7cb5667e8
commit 00da664a60
2 changed files with 12 additions and 4 deletions

View File

@ -446,7 +446,8 @@ int Snes9xConfig::load_config_file ()
} }
else else
{ {
chmod (path.c_str (), 0755); if (!(file_info.st_mode & 0700))
chmod (path.c_str (), file_info.st_mode | 0700);
} }
path = get_config_file_name (); path = get_config_file_name ();

View File

@ -168,11 +168,18 @@ S9xGetDirectory (enum s9x_getdirtype dirtype)
path[0] = '\0'; path[0] = '\0';
} }
/* Try and mkdir, whether it exists or not */ /* Check if directory exists, make it and/or set correct permissions */
if (dirtype != HOME_DIR && path[0] != '\0') if (dirtype != HOME_DIR && path[0] != '\0')
{ {
mkdir (path, 0755); struct stat file_info;
chmod (path, 0755);
if (stat(path, &file_info) == -1)
{
mkdir(path, 0755);
chmod(path, 0755);
}
else if (!(file_info.st_mode & 0700))
chmod(path, file_info.st_mode | 0700);
} }
/* Anything else, use ROM filename path */ /* Anything else, use ROM filename path */