mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 21:40:02 +00:00
Honor the LIBRETRO_DATABASE_DIRECTORY environment variable. (#17431)
* Partially revert a change made in 69ceb95ddc. The change caused the 'libretro_directory' config option to always revert to the default value, which was not intended behavior. Reported-by: Michael Cook * platform: Honor the LIBRETRO_DATABASE_DIRECTORY environment variable. This is a follow-up to commit 69ceb95ddc. * frontend/drivers/platform_unix.c (libretro_database_directory): New variable. (frontend_unix_get_env): Set DEFAULT_DIR_DATABASE to the value of the LIBRETRO_DATABASE_DIRECTORY environment variable, if available. * frontend/drivers/platform_win32.c: Likewise. * configuration.c (config_load_file) <libretro_database_directory>: New variable. Use the values of the LIBRETRO_DATABASE_DIRECTORY environment variables instead of their corresponding configured values, when set. * docs/retroarch.6: Document. * retroarch.c (retroarch_print_help): List supported environment variables, and cross-reference the man page.
This commit is contained in:
parent
5db9b7f8c9
commit
274cd419fa
@ -3571,6 +3571,7 @@ static bool config_load_file(global_t *global,
|
||||
char* libretro_directory = NULL;
|
||||
char* libretro_assets_directory = NULL;
|
||||
char* libretro_autoconfig_directory = NULL;
|
||||
char* libretro_database_directory = NULL;
|
||||
char* libretro_system_directory = NULL;
|
||||
char* libretro_video_filter_directory = NULL;
|
||||
char* libretro_video_shader_directory = NULL;
|
||||
@ -3855,6 +3856,12 @@ static bool config_load_file(global_t *global,
|
||||
strlcpy(path_settings[i].ptr, tmp_str, PATH_MAX_LENGTH);
|
||||
}
|
||||
|
||||
#if !IOS
|
||||
if (config_get_path(conf, "libretro_directory", tmp_str, sizeof(tmp_str)))
|
||||
configuration_set_string(settings,
|
||||
settings->paths.directory_libretro, tmp_str);
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
if (conf)
|
||||
video_driver_load_settings(global, conf);
|
||||
@ -3871,13 +3878,19 @@ static bool config_load_file(global_t *global,
|
||||
}
|
||||
|
||||
libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY");
|
||||
if (libretro_autoconfig_directory)
|
||||
if (libretro_autoconfig_directory) /* override configuration value */
|
||||
configuration_set_string(settings,
|
||||
settings->paths.directory_autoconfig,
|
||||
libretro_autoconfig_directory);
|
||||
|
||||
libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY");
|
||||
if (libretro_database_directory) /* override configuration value */
|
||||
configuration_set_string(settings,
|
||||
settings->paths.path_content_database,
|
||||
libretro_database_directory);
|
||||
|
||||
libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY");
|
||||
if (libretro_system_directory)
|
||||
if (libretro_system_directory) /* override configuration value */
|
||||
configuration_set_string(settings,
|
||||
settings->paths.directory_system,
|
||||
libretro_system_directory);
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" retroarch.6:
|
||||
|
||||
.TH "RETROARCH" "6" "January 16, 2025" "RETROARCH" "System Manager's Manual: retroarch"
|
||||
.TH "RETROARCH" "6" "January 18, 2025" "RETROARCH" "System Manager's Manual: retroarch"
|
||||
|
||||
.SH NAME
|
||||
|
||||
@ -261,6 +261,12 @@ Specify the directory where RetroArch looks for controller
|
||||
auto-configuration files, overriding the value of the
|
||||
"joypad_autoconfig_dir" configuration file option.
|
||||
|
||||
.TP
|
||||
\fBLIBRETRO_DATABASE_DIRECTORY\fR
|
||||
Specify the directory where RetroArch looks for database files,
|
||||
overriding the value of the "content_database_path" configuration file
|
||||
option.
|
||||
|
||||
.TP
|
||||
\fBLIBRETRO_SYSTEM_DIRECTORY\fR
|
||||
Specify the directory where RetroArch looks for system files,
|
||||
|
@ -1325,6 +1325,7 @@ static void frontend_unix_get_env(int *argc,
|
||||
const char* libretro_directory = getenv("LIBRETRO_DIRECTORY");
|
||||
const char* libretro_assets_directory = getenv("LIBRETRO_ASSETS_DIRECTORY");
|
||||
const char* libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY");
|
||||
const char* libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY");
|
||||
const char* libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY");
|
||||
const char* libretro_video_filter_directory = getenv("LIBRETRO_VIDEO_FILTER_DIRECTORY");
|
||||
const char* libretro_video_shader_directory = getenv("LIBRETRO_VIDEO_SHADER_DIRECTORY");
|
||||
@ -1889,6 +1890,11 @@ static void frontend_unix_get_env(int *argc,
|
||||
"records_config", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_CONFIG]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT], base_path,
|
||||
"records", sizeof(g_defaults.dirs[DEFAULT_DIR_RECORD_OUTPUT]));
|
||||
if (!string_is_empty(libretro_database_directory))
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_DATABASE],
|
||||
libretro_database_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
else
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], base_path,
|
||||
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
if (!string_is_empty(libretro_video_shader_directory))
|
||||
|
@ -568,6 +568,7 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
const char *libretro_directory = getenv("LIBRETRO_DIRECTORY");
|
||||
const char *libretro_assets_directory = getenv("LIBRETRO_ASSETS_DIRECTORY");
|
||||
const char* libretro_autoconfig_directory = getenv("LIBRETRO_AUTOCONFIG_DIRECTORY");
|
||||
const char* libretro_database_directory = getenv("LIBRETRO_DATABASE_DIRECTORY");
|
||||
const char* libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY");
|
||||
const char* libretro_video_filter_directory = getenv("LIBRETRO_VIDEO_FILTER_DIRECTORY");
|
||||
const char* libretro_video_shader_directory = getenv("LIBRETRO_VIDEO_SHADER_DIRECTORY");
|
||||
@ -595,6 +596,11 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
":\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS],
|
||||
":\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
|
||||
if (!string_is_empty(libretro_database_directory))
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_DATABASE],
|
||||
libretro_database_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE],
|
||||
":\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
|
||||
|
20
retroarch.c
20
retroarch.c
@ -6519,7 +6519,27 @@ static void retroarch_print_help(const char *arg0)
|
||||
"Path for the save state files (*.state). (DEPRECATED, use --appendconfig and savestate_directory)\n"
|
||||
, sizeof(buf) - _len);
|
||||
|
||||
/* Flush buffer here to avoid the error "error: string length ‘752’
|
||||
* is greater than the length ‘509’ ISO C90 compilers are required
|
||||
* to support" */
|
||||
fputs(buf, stdout);
|
||||
|
||||
#if defined(__linux__) || defined(__GNU__) || (defined(BSD) && !defined(__MACH__))
|
||||
buf[0] = '\0';
|
||||
_len = 0;
|
||||
_len += strlcpy(buf + _len,
|
||||
"\nThe following environment variables are supported:\n\n"
|
||||
" LIBRETRO_ASSETS_DIRECTORY\n"
|
||||
" LIBRETRO_AUTOCONFIG_DIRECTORY\n"
|
||||
" LIBRETRO_DATABASE_DIRECTORY\n"
|
||||
" LIBRETRO_DIRECTORY\n"
|
||||
" LIBRETRO_SYSTEM_DIRECTORY\n"
|
||||
" LIBRETRO_VIDEO_FILTER_DIRECTORY\n"
|
||||
" LIBRETRO_VIDEO_SHADER_DIRECTORY\n\n"
|
||||
"Refer to `man 6 retroarch' for a description of what they do.\n"
|
||||
, sizeof(buf) - _len);
|
||||
fputs(buf, stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
Loading…
x
Reference in New Issue
Block a user