From 33e5a9286792d829ec5b56344840f250c0e5df8e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 22 Apr 2019 02:33:12 +0200 Subject: [PATCH] We should be able to rely on the return value of path_mkdir instead of doing an additional negative path_is_directory check afterwards --- paths.c | 6 ++---- retroarch.c | 5 ++--- runtime_file.c | 4 +--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/paths.c b/paths.c index 694033a9b6..57df1a8989 100644 --- a/paths.c +++ b/paths.c @@ -96,8 +96,7 @@ void path_set_redirect(void) * if everything fails revert to the original path. */ if(!path_is_directory(new_savefile_dir)) { - path_mkdir(new_savefile_dir); - if(!path_is_directory(new_savefile_dir)) + if (!path_mkdir(new_savefile_dir)) { RARCH_LOG("%s %s\n", msg_hash_to_str(MSG_REVERTING_SAVEFILE_DIRECTORY_TO), @@ -122,8 +121,7 @@ void path_set_redirect(void) * If everything fails, revert to the original path. */ if(!path_is_directory(new_savestate_dir)) { - path_mkdir(new_savestate_dir); - if(!path_is_directory(new_savestate_dir)) + if (!path_mkdir(new_savestate_dir)) { RARCH_LOG("%s %s\n", msg_hash_to_str(MSG_REVERTING_SAVESTATE_DIRECTORY_TO), diff --git a/retroarch.c b/retroarch.c index 3845ed296f..406af91630 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4894,7 +4894,7 @@ bool rarch_write_debug_info(void) input_config_get_bind_string(descriptor, keybind, auto_bind, sizeof(descriptor)); - if(!strstr(descriptor, "Auto") && auto_bind && !auto_bind->valid && auto_bind->joykey != 0xFFFF && !string_is_empty(auto_bind->joykey_label)) + if (!strstr(descriptor, "Auto") && auto_bind && !auto_bind->valid && auto_bind->joykey != 0xFFFF && !string_is_empty(auto_bind->joykey_label)) rebind++; } } @@ -5365,8 +5365,7 @@ void rarch_log_file_init(void) /* Create log directory, if required */ if (!path_is_directory(settings->paths.log_dir)) { - path_mkdir(settings->paths.log_dir); - if(!path_is_directory(settings->paths.log_dir)) + if (!path_mkdir(settings->paths.log_dir)) { /* Re-enable console logging and output error message */ retro_main_log_file_init(NULL, false); diff --git a/runtime_file.c b/runtime_file.c index 5ed29d6f95..e0e4d1ed80 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -353,9 +353,7 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path, /* Create directory, if required */ if (!path_is_directory(log_file_dir)) { - path_mkdir(log_file_dir); - - if(!path_is_directory(log_file_dir)) + if (!path_mkdir(log_file_dir)) { RARCH_ERR("[runtime] failed to create directory for runtime log: %s.\n", log_file_dir); return NULL;