diff --git a/configuration.c b/configuration.c index bf21360c34..f9f7d9903e 100644 --- a/configuration.c +++ b/configuration.c @@ -1274,6 +1274,8 @@ static struct config_path_setting *populate_settings_path(settings_t *settings, settings->paths.directory_thumbnails, true, NULL, true); SETTING_PATH("playlist_directory", settings->paths.directory_playlist, true, NULL, true); + SETTING_PATH("runtime_log_directory", + settings->paths.directory_runtime_log, true, NULL, true); SETTING_PATH("joypad_autoconfig_dir", settings->paths.directory_autoconfig, false, NULL, true); SETTING_PATH("audio_filter_dir", @@ -2062,6 +2064,7 @@ void config_set_defaults(void) *settings->paths.directory_dynamic_wallpapers = '\0'; *settings->paths.directory_thumbnails = '\0'; *settings->paths.directory_playlist = '\0'; + *settings->paths.directory_runtime_log = '\0'; *settings->paths.directory_autoconfig = '\0'; #ifdef HAVE_MENU *settings->paths.directory_menu_content = '\0'; @@ -3123,6 +3126,8 @@ static bool config_load_file(const char *path, bool set_defaults, *settings->paths.directory_thumbnails = '\0'; if (string_is_equal(settings->paths.directory_playlist, "default")) *settings->paths.directory_playlist = '\0'; + if (string_is_equal(settings->paths.directory_runtime_log, "default")) + *settings->paths.directory_runtime_log = '\0'; #ifdef HAVE_MENU if (string_is_equal(settings->paths.directory_menu_content, "default")) *settings->paths.directory_menu_content = '\0'; diff --git a/configuration.h b/configuration.h index ee26c7f766..62018ae0c8 100644 --- a/configuration.h +++ b/configuration.h @@ -580,6 +580,7 @@ typedef struct settings char directory_system[PATH_MAX_LENGTH]; char directory_cache[PATH_MAX_LENGTH]; char directory_playlist[PATH_MAX_LENGTH]; + char directory_runtime_log[PATH_MAX_LENGTH]; char directory_core_assets[PATH_MAX_LENGTH]; char directory_assets[PATH_MAX_LENGTH]; char directory_dynamic_wallpapers[PATH_MAX_LENGTH]; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 22c84fb042..f6f9d58cc2 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -827,6 +827,8 @@ MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, "playlist_collection_entry") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_DIRECTORY, "playlist_directory") +MSG_HASH(MENU_ENUM_LABEL_RUNTIME_LOG_DIRECTORY, + "runtime_log_directory") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_ENTRY, "playlist_entry") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SETTINGS, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 590b916db2..dfaaf03157 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -8370,6 +8370,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_RUNTIME_LOG_AGGREGATE, "Keeps track of how long each item of content has run for, recorded as the aggregate total across all cores." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RUNTIME_LOG_DIRECTORY, + "Runtime Logs" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RUNTIME_LOG_DIRECTORY, + "Save runtime log files to this directory." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_SUBLABELS, "Show playlist sublabels" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index cc9bdee061..108446b63c 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -453,6 +453,7 @@ default_sublabel_macro(action_bind_sublabel_core_directory, default_sublabel_macro(action_bind_sublabel_core_info_directory, MENU_ENUM_SUBLABEL_LIBRETRO_INFO_PATH) default_sublabel_macro(action_bind_sublabel_joypad_autoconfig_directory, MENU_ENUM_SUBLABEL_JOYPAD_AUTOCONFIG_DIR) default_sublabel_macro(action_bind_sublabel_playlists_directory, MENU_ENUM_SUBLABEL_PLAYLIST_DIRECTORY) +default_sublabel_macro(action_bind_sublabel_runtime_log_directory, MENU_ENUM_SUBLABEL_RUNTIME_LOG_DIRECTORY) default_sublabel_macro(action_bind_sublabel_cache_directory, MENU_ENUM_SUBLABEL_CACHE_DIRECTORY) default_sublabel_macro(action_bind_sublabel_database_directory, MENU_ENUM_SUBLABEL_CONTENT_DATABASE_DIRECTORY) default_sublabel_macro(action_bind_sublabel_cursor_directory, MENU_ENUM_SUBLABEL_CURSOR_DIRECTORY) @@ -1166,6 +1167,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlists_directory); break; + case MENU_ENUM_LABEL_RUNTIME_LOG_DIRECTORY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_runtime_log_directory); + break; case MENU_ENUM_LABEL_JOYPAD_AUTOCONFIG_DIR: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_joypad_autoconfig_directory); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 3e3dfeec08..0274020a6c 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -195,6 +195,7 @@ default_fill_title_macro(action_get_title_config_directory, MENU_ENUM_LABEL default_fill_title_macro(action_get_title_input_remapping_directory, MENU_ENUM_LABEL_VALUE_INPUT_REMAPPING_DIRECTORY) default_fill_title_macro(action_get_title_autoconfig_directory, MENU_ENUM_LABEL_VALUE_JOYPAD_AUTOCONFIG_DIR ) default_fill_title_macro(action_get_title_playlist_directory, MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY) +default_fill_title_macro(action_get_title_runtime_log_directory, MENU_ENUM_LABEL_VALUE_RUNTIME_LOG_DIRECTORY) default_fill_title_macro(action_get_title_browser_directory, MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY) default_fill_title_macro(action_get_title_content_directory, MENU_ENUM_LABEL_VALUE_CONTENT_DIR) default_fill_title_macro(action_get_title_screenshot_directory, MENU_ENUM_LABEL_VALUE_SCREENSHOT_DIRECTORY) @@ -666,6 +667,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_PLAYLIST_DIRECTORY: BIND_ACTION_GET_TITLE(cbs, action_get_title_playlist_directory); break; + case MENU_ENUM_LABEL_RUNTIME_LOG_DIRECTORY: + BIND_ACTION_GET_TITLE(cbs, action_get_title_runtime_log_directory); + break; case MENU_ENUM_LABEL_CONTENT_DIRECTORY: BIND_ACTION_GET_TITLE(cbs, action_get_title_content_directory); break; @@ -995,6 +999,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_PLAYLIST_DIRECTORY: BIND_ACTION_GET_TITLE(cbs, action_get_title_playlist_directory); break; + case MENU_LABEL_RUNTIME_LOG_DIRECTORY: + BIND_ACTION_GET_TITLE(cbs, action_get_title_runtime_log_directory); + break; case MENU_LABEL_CONTENT_DIRECTORY: BIND_ACTION_GET_TITLE(cbs, action_get_title_content_directory); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 036bb38cd6..5bd8197f3d 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6707,6 +6707,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_PLAYLIST_DIRECTORY, PARSE_ONLY_DIR, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_RUNTIME_LOG_DIRECTORY, + PARSE_ONLY_DIR, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_SAVEFILE_DIRECTORY, PARSE_ONLY_DIR, false); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 308e00693b..476500d818 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -11248,6 +11248,21 @@ static bool setting_append_list( general_read_handler); (*list)[list_info->index - 1].action_start = directory_action_start_generic; + CONFIG_DIR( + list, list_info, + settings->paths.directory_runtime_log, + sizeof(settings->paths.directory_runtime_log), + MENU_ENUM_LABEL_RUNTIME_LOG_DIRECTORY, + MENU_ENUM_LABEL_VALUE_RUNTIME_LOG_DIRECTORY, + "", + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_start = directory_action_start_generic; + CONFIG_DIR( list, list_info, dir_get_ptr(RARCH_DIR_SAVEFILE), diff --git a/msg_hash.h b/msg_hash.h index 57d36f0b99..d73ebc9a9e 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1695,6 +1695,7 @@ enum msg_hash_enums MENU_LABEL(RGUI_BROWSER_DIRECTORY), MENU_LABEL(CONTENT_DATABASE_DIRECTORY), MENU_LABEL(PLAYLIST_DIRECTORY), + MENU_LABEL(RUNTIME_LOG_DIRECTORY), MENU_LABEL(CORE_ASSETS_DIRECTORY), MENU_LABEL(SCREENSHOT_DIRECTORY), MENU_LABEL(CONTENT_DIRECTORY), @@ -2458,6 +2459,7 @@ enum msg_hash_enums #define MENU_LABEL_RGUI_BROWSER_DIRECTORY 0xa86cba73U #define MENU_LABEL_CONTENT_DATABASE_DIRECTORY 0x6b443f80U #define MENU_LABEL_PLAYLIST_DIRECTORY 0x6361820bU +#define MENU_LABEL_RUNTIME_LOG_DIRECTORY 0xfaca231eU #define MENU_LABEL_CORE_ASSETS_DIRECTORY 0x8ba5ee54U #define MENU_LABEL_CONTENT_DIRECTORY 0x7738dc14U #define MENU_LABEL_RGUI_CONFIG_DIRECTORY 0x0cb3e005U diff --git a/runtime_file.c b/runtime_file.c index 5550a46002..faea97d5a9 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -293,9 +293,9 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path, if (!settings) return NULL; - if (string_is_empty(settings->paths.directory_playlist)) + if (string_is_empty(settings->paths.directory_runtime_log) && string_is_empty(settings->paths.directory_playlist)) { - RARCH_ERR("Playlist directory is undefined - cannot save runtime logs.\n"); + RARCH_ERR("Runtime log directory is undefined - cannot save runtime log files.\n"); return NULL; } @@ -328,11 +328,18 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path, return NULL; /* Get runtime log directory */ - fill_pathname_join( - tmp_buf, - settings->paths.directory_playlist, - "logs", - sizeof(tmp_buf)); + if (string_is_empty(settings->paths.directory_runtime_log)) + { + /* If 'custom' runtime log path is undefined, + * use default 'playlists/logs' directory... */ + fill_pathname_join( + tmp_buf, + settings->paths.directory_playlist, + "logs", + sizeof(tmp_buf)); + } + else + strlcpy(tmp_buf, settings->paths.directory_runtime_log, sizeof(tmp_buf)); if (log_per_core) { @@ -343,9 +350,7 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path, sizeof(log_file_dir)); } else - { strlcpy(log_file_dir, tmp_buf, sizeof(log_file_dir)); - } if (string_is_empty(log_file_dir)) return NULL;