diff --git a/configuration.c b/configuration.c index 5808a3f21c55..5d1913ebf31a 100644 --- a/configuration.c +++ b/configuration.c @@ -3573,6 +3573,8 @@ static bool config_load_file(global_t *global, { unsigned i; char tmp_str[PATH_MAX_LENGTH]; + char* libretro_directory = NULL; + char* libretro_assets_directory = NULL; static bool first_load = true; bool without_overrides = false; unsigned msg_color = 0; @@ -3849,7 +3851,11 @@ static bool config_load_file(global_t *global, } #if !IOS - if (config_get_path(conf, "libretro_directory", tmp_str, sizeof(tmp_str))) + libretro_directory = getenv("LIBRETRO_DIRECTORY"); + if (libretro_directory) { /* override the configured value */ + configuration_set_string(settings, + settings->paths.directory_libretro, libretro_directory); + } else if (config_get_path(conf, "libretro_directory", tmp_str, sizeof(tmp_str))) configuration_set_string(settings, settings->paths.directory_libretro, tmp_str); #endif @@ -4040,7 +4046,11 @@ static bool config_load_file(global_t *global, *settings->paths.directory_audio_filter = '\0'; if (string_is_equal(settings->paths.directory_core_assets, "default")) *settings->paths.directory_core_assets = '\0'; - if (string_is_equal(settings->paths.directory_assets, "default")) + libretro_assets_directory = getenv("LIBRETRO_ASSETS_DIRECTORY"); + if (libretro_assets_directory) { /* override the configure value */ + configuration_set_string(settings, + settings->paths.directory_assets, libretro_assets_directory); + } else if (string_is_equal(settings->paths.directory_assets, "default")) *settings->paths.directory_assets = '\0'; #ifdef _3DS if (string_is_equal(settings->paths.directory_bottom_assets, "default")) diff --git a/docs/retroarch.6 b/docs/retroarch.6 index 7478040e176a..fa36cb8bd6e1 100644 --- a/docs/retroarch.6 +++ b/docs/retroarch.6 @@ -1,6 +1,6 @@ .\" retroarch.6: -.TH "RETROARCH" "6" "November 1, 2011" "RETROARCH" "System Manager's Manual: retroarch" +.TH "RETROARCH" "6" "September 28, 2024" "RETROARCH" "System Manager's Manual: retroarch" .SH NAME @@ -239,3 +239,15 @@ Disables all kinds of content patching. .TP \fB-D, --detach\fR Detach from the current console. This is currently only relevant for Microsoft Windows. + +.SH ENVIRONMENT +\fBretroarch\fR supports the following environment variables: +.TP +\fBLIBRETRO_DIRECTORY\fR +Specify the directory where RetroArch looks for its core files. It +overrides the value of the "libretro_directory" configuration file option. +.TP +\fBLIBRETRO_ASSETS_DIRECTORY\fR +Specify the directory where RetroArch looks to find its assets. It +overrides the value of the "assets_directory" configuration file +option.