mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
fix setting and clearing system directory when using content dir
This commit is contained in:
parent
637c977b45
commit
b717828cf0
@ -548,8 +548,8 @@ static void event_deinit_core(bool reinit)
|
||||
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
|
||||
|
||||
/* restore system directory if it was set to <content dir> */
|
||||
if(orig_system_dir_empty)
|
||||
strlcpy(settings->system_directory,"",sizeof(settings->system_directory));
|
||||
if(settings->system_in_content_dir)
|
||||
settings->system_directory[0] = '\0';
|
||||
|
||||
/* auto overrides: reload the original config */
|
||||
if(global->overrides_active)
|
||||
|
@ -1714,10 +1714,14 @@ static bool config_load_file(const char *path, bool set_defaults)
|
||||
{
|
||||
RARCH_WARN("system_directory is not set in config. Assuming system directory is same folder as game: \"%s\".\n",
|
||||
settings->system_directory);
|
||||
settings->system_in_content_dir = true;
|
||||
}
|
||||
|
||||
if (!strcmp(settings->system_directory, "default"))
|
||||
{
|
||||
*settings->system_directory = '\0';
|
||||
settings->system_in_content_dir = true;
|
||||
}
|
||||
|
||||
config_read_keybinds_conf(conf);
|
||||
|
||||
|
@ -303,6 +303,7 @@ typedef struct settings
|
||||
char resampler_directory[PATH_MAX_LENGTH];
|
||||
char screenshot_directory[PATH_MAX_LENGTH];
|
||||
char system_directory[PATH_MAX_LENGTH];
|
||||
bool system_in_content_dir;
|
||||
|
||||
char extraction_directory[PATH_MAX_LENGTH];
|
||||
char playlist_directory[PATH_MAX_LENGTH];
|
||||
|
@ -751,8 +751,15 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
|
||||
if (!settings->system_directory || settings->system_directory[0] == '\0')
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR %s\n",global->fullpath);
|
||||
fill_pathname_basedir(settings->system_directory, global->fullpath,
|
||||
sizeof(settings->system_directory));
|
||||
}
|
||||
*(const char**)data = *settings->system_directory ?
|
||||
settings->system_directory : NULL;
|
||||
|
||||
RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n",
|
||||
settings->system_directory);
|
||||
break;
|
||||
|
@ -48,8 +48,8 @@ void main_exit_save_config(void)
|
||||
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
|
||||
|
||||
/* restore system directory if it was set to <content dir> */
|
||||
if(orig_system_dir_empty)
|
||||
strlcpy(settings->system_directory,"",sizeof(settings->system_directory));
|
||||
if(settings->system_in_content_dir)
|
||||
settings->system_directory[0] = '\0';
|
||||
|
||||
/* Save last core-specific config to the default config location,
|
||||
* needed on consoles for core switching and reusing last good
|
||||
|
21
retroarch.c
21
retroarch.c
@ -61,7 +61,6 @@
|
||||
|
||||
char orig_savestate_dir[PATH_MAX_LENGTH];
|
||||
char orig_savefile_dir[PATH_MAX_LENGTH];
|
||||
bool orig_system_dir_empty = false;
|
||||
|
||||
/* Descriptive names for options without short variant. Please keep the name in
|
||||
sync with the option name. Order does not matter. */
|
||||
@ -314,11 +313,12 @@ static void set_special_paths(char **argv, unsigned num_content)
|
||||
/* If this is already set,
|
||||
* do not overwrite it as this was initialized before in
|
||||
* a menu or otherwise. */
|
||||
if (settings->system_directory[0] == '\0')
|
||||
orig_system_dir_empty = true;
|
||||
if (!*settings->system_directory)
|
||||
if (!settings->system_directory || settings->system_directory[0] == '\0')
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",argv[0]);
|
||||
fill_pathname_basedir(settings->system_directory, argv[0],
|
||||
sizeof(settings->system_directory));
|
||||
}
|
||||
}
|
||||
|
||||
void set_paths_redirect(const char *path)
|
||||
@ -429,12 +429,13 @@ void rarch_set_paths(const char *path)
|
||||
|
||||
/* If this is already set, do not overwrite it
|
||||
* as this was initialized before in a menu or otherwise. */
|
||||
if (*settings->system_directory)
|
||||
return;
|
||||
if (settings->system_directory[0] == '\0')
|
||||
orig_system_dir_empty = true;
|
||||
fill_pathname_basedir(settings->system_directory, path,
|
||||
sizeof(settings->system_directory));
|
||||
if (!settings->system_directory || settings->system_directory[0] == '\0')
|
||||
{
|
||||
RARCH_WARN("SYSTEM DIR is empty, fill assume CONTENT DIR %s\n",path);
|
||||
fill_pathname_basedir(settings->system_directory, path,
|
||||
sizeof(settings->system_directory));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user