mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Start taking settings dependencies out of rarch_log_file_init
function
This commit is contained in:
parent
08239ead20
commit
d631da7d11
@ -1249,8 +1249,8 @@ void fill_pathname_home_dir(char *s, size_t len)
|
||||
|
||||
bool is_path_accessible_using_standard_io(const char *path)
|
||||
{
|
||||
bool result = true;
|
||||
#ifdef __WINRT__
|
||||
bool result;
|
||||
size_t path_sizeof = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *relative_path_abbrev = (char*)malloc(path_sizeof);
|
||||
fill_pathname_abbreviate_special(relative_path_abbrev, path, path_sizeof);
|
||||
@ -1258,8 +1258,6 @@ bool is_path_accessible_using_standard_io(const char *path)
|
||||
result = strlen(relative_path_abbrev) >= 2 && (relative_path_abbrev[0] == ':' || relative_path_abbrev[0] == '~') && path_char_is_slash(relative_path_abbrev[1]);
|
||||
|
||||
free(relative_path_abbrev);
|
||||
return result;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
@ -6514,7 +6514,10 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
case MENU_ENUM_LABEL_LOG_VERBOSITY:
|
||||
if (!verbosity_is_enabled())
|
||||
{
|
||||
rarch_log_file_init();
|
||||
rarch_log_file_init(
|
||||
settings->bools.log_to_file,
|
||||
settings->bools.log_to_file_timestamp,
|
||||
settings->paths.log_dir);
|
||||
verbosity_enable();
|
||||
}
|
||||
else
|
||||
@ -6528,7 +6531,10 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
if (verbosity_is_enabled())
|
||||
{
|
||||
if (settings->bools.log_to_file && !is_logging_to_file())
|
||||
rarch_log_file_init();
|
||||
rarch_log_file_init(
|
||||
settings->bools.log_to_file,
|
||||
settings->bools.log_to_file_timestamp,
|
||||
settings->paths.log_dir);
|
||||
else if (!settings->bools.log_to_file && is_logging_to_file())
|
||||
rarch_log_file_deinit();
|
||||
}
|
||||
@ -6539,7 +6545,10 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
if (verbosity_is_enabled() && is_logging_to_file())
|
||||
{
|
||||
rarch_log_file_deinit();
|
||||
rarch_log_file_init();
|
||||
rarch_log_file_init(
|
||||
settings->bools.log_to_file,
|
||||
settings->bools.log_to_file_timestamp,
|
||||
settings->paths.log_dir);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_SMOOTH:
|
||||
|
43
retroarch.c
43
retroarch.c
@ -25010,20 +25010,16 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
|
||||
exit(0);
|
||||
|
||||
case RA_OPT_LOG_FILE:
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
/* Enable 'log to file' */
|
||||
configuration_set_bool(configuration_settings,
|
||||
configuration_settings->bools.log_to_file, true);
|
||||
|
||||
/* Enable 'log to file' */
|
||||
configuration_set_bool(settings,
|
||||
settings->bools.log_to_file, true);
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LOG_TO_FILE, NULL);
|
||||
|
||||
retroarch_override_setting_set(
|
||||
RARCH_OVERRIDE_SETTING_LOG_TO_FILE, NULL);
|
||||
|
||||
/* Cache log file path override */
|
||||
log_file_override_active = true;
|
||||
strlcpy(log_file_override_path, optarg, sizeof(log_file_override_path));
|
||||
}
|
||||
/* Cache log file path override */
|
||||
log_file_override_active = true;
|
||||
strlcpy(log_file_override_path, optarg, sizeof(log_file_override_path));
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
@ -25049,7 +25045,10 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (verbosity_is_enabled())
|
||||
rarch_log_file_init();
|
||||
rarch_log_file_init(
|
||||
configuration_settings->bools.log_to_file,
|
||||
configuration_settings->bools.log_to_file_timestamp,
|
||||
configuration_settings->paths.log_dir);
|
||||
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
RARCH_LOG("RetroArch %s (Git %s)\n",
|
||||
@ -27884,14 +27883,15 @@ void retroarch_force_video_driver_fallback(const char *driver)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void rarch_log_file_init(void)
|
||||
void rarch_log_file_init(
|
||||
bool log_to_file,
|
||||
bool log_to_file_timestamp,
|
||||
const char *log_dir
|
||||
)
|
||||
{
|
||||
char log_directory[PATH_MAX_LENGTH];
|
||||
char log_file_path[PATH_MAX_LENGTH];
|
||||
FILE *fp = NULL;
|
||||
settings_t *settings = configuration_settings;
|
||||
bool log_to_file = settings->bools.log_to_file;
|
||||
bool log_to_file_timestamp = settings->bools.log_to_file_timestamp;
|
||||
bool logging_to_file = is_logging_to_file();
|
||||
|
||||
log_directory[0] = '\0';
|
||||
@ -27941,7 +27941,8 @@ void rarch_log_file_init(void)
|
||||
if (log_file_override_active)
|
||||
{
|
||||
/* Get log directory */
|
||||
const char *last_slash = find_last_slash(log_file_override_path);
|
||||
const char *last_slash =
|
||||
find_last_slash(log_file_override_path);
|
||||
|
||||
if (last_slash)
|
||||
{
|
||||
@ -27956,13 +27957,13 @@ void rarch_log_file_init(void)
|
||||
/* Get log file path */
|
||||
strlcpy(log_file_path, log_file_override_path, sizeof(log_file_path));
|
||||
}
|
||||
else if (!string_is_empty(settings->paths.log_dir))
|
||||
else if (!string_is_empty(log_dir))
|
||||
{
|
||||
/* Get log directory */
|
||||
strlcpy(log_directory, settings->paths.log_dir, sizeof(log_directory));
|
||||
strlcpy(log_directory, log_dir, sizeof(log_directory));
|
||||
|
||||
/* Get log file path */
|
||||
fill_pathname_join(log_file_path, settings->paths.log_dir,
|
||||
fill_pathname_join(log_file_path, log_dir,
|
||||
log_to_file_timestamp
|
||||
? timestamped_log_file_name
|
||||
: "retroarch.log",
|
||||
|
@ -384,7 +384,10 @@ struct retro_system_info *runloop_get_libretro_system_info(void);
|
||||
|
||||
void retroarch_force_video_driver_fallback(const char *driver);
|
||||
|
||||
void rarch_log_file_init(void);
|
||||
void rarch_log_file_init(
|
||||
bool log_to_file,
|
||||
bool log_to_file_timestamp,
|
||||
const char *log_dir);
|
||||
|
||||
void rarch_log_file_deinit(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user