mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Merge pull request #11595 from libretro/dir_check_defaults_only_once
Only attempt to call dir_check_defaults once per runtime session
This commit is contained in:
commit
8921d31247
@ -94,8 +94,6 @@ static void get_first_valid_core(char* path_return, size_t len)
|
||||
static void frontend_ctr_get_environment_settings(int* argc, char* argv[],
|
||||
void* args, void* params_data)
|
||||
{
|
||||
(void)args;
|
||||
|
||||
fill_pathname_basedir(g_defaults.dirs[DEFAULT_DIR_PORT], elf_path_cst, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
|
||||
|
||||
@ -129,6 +127,10 @@ static void frontend_ctr_get_environment_settings(int* argc, char* argv[],
|
||||
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
|
||||
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ctr_deinit(void* data)
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include "../../verbosity.h"
|
||||
#include "../../msg_hash.h"
|
||||
#include "../../ui/ui_companion_driver.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#if 1
|
||||
#define RELEASE_BUILD
|
||||
@ -500,6 +501,10 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
CFRelease(bundle_path);
|
||||
CFRelease(bundle_url);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_darwin_load_content(void)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
static enum frontend_fork dos_fork_mode = FRONTEND_FORK_NONE;
|
||||
|
||||
@ -105,12 +106,9 @@ static void frontend_dos_get_env_settings(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], base_path,
|
||||
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_dos_exec(const char *path, bool should_load_game)
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "../../command.h"
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
void dummyErrnoCodes(void);
|
||||
void emscripten_mainloop(void);
|
||||
@ -151,12 +152,9 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.path_config, user_path,
|
||||
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -283,6 +283,7 @@ static void frontend_gx_get_environment_settings(
|
||||
}
|
||||
}
|
||||
#endif
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -210,14 +210,9 @@ static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
||||
RARCH_LOG("Auto-start game %s.\n", argv[2]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
dir_check_defaults("host0:app/custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_orbis_deinit(void *data)
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../../defaults.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../paths.h"
|
||||
#include <elf-loader.h>
|
||||
|
||||
|
||||
@ -140,12 +141,10 @@ static void frontend_ps2_get_environment_settings(int *argc, char *argv[],
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ps2_init(void *data)
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "../../defines/ps3_defines.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#ifdef __PSL1GHT__
|
||||
#define EMULATOR_CONTENT_DIR "SSNE10001"
|
||||
@ -206,6 +207,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
||||
verbosity_enable();
|
||||
else
|
||||
verbosity_disable();
|
||||
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -329,6 +332,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
||||
verbosity_enable();
|
||||
else
|
||||
verbosity_disable();
|
||||
ps3_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -217,14 +217,9 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
||||
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_psp_deinit(void *data)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "../../defaults.h"
|
||||
#include "../../dynamic.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
static void frontend_qnx_init(void *data)
|
||||
{
|
||||
@ -162,15 +163,12 @@ static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
|
||||
RARCH_LOG( "Asset copy successful.\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
|
||||
/* set glui as default menu */
|
||||
/* set GLUI as default menu */
|
||||
snprintf(g_defaults.settings_menu, sizeof(g_defaults.settings_menu), "glui");
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
enum frontend_architecture frontend_qnx_get_architecture(void)
|
||||
|
@ -276,6 +276,10 @@ static void frontend_switch_get_environment_settings(
|
||||
g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
FILE_PATH_MAIN_CONFIG,
|
||||
sizeof(g_defaults.path_config));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_switch_deinit(void *data)
|
||||
|
@ -1853,12 +1853,13 @@ static void frontend_unix_get_env(int *argc,
|
||||
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
|
||||
#endif
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(ANDROID)
|
||||
dir_check_defaults("host0:app/custom.ini");
|
||||
#else
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../ui/drivers/ui_win32.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#include "../../uwp/uwp_func.h"
|
||||
|
||||
@ -390,6 +391,15 @@ static void frontend_uwp_environment_get(int *argc, char *argv[],
|
||||
strcpy_literal(g_defaults.settings_menu, "glui");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
{
|
||||
char custom_ini_path[PATH_MAX_LENGTH];
|
||||
fill_pathname_expand_special(custom_ini_path,
|
||||
"~\\custom.ini", sizeof(custom_ini_path));
|
||||
dir_check_defaults(custom_ini_path);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t frontend_uwp_get_mem_total(void)
|
||||
|
@ -136,12 +136,9 @@ static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
if (!string_is_empty(dir_path))
|
||||
path_mkdir(dir_path);
|
||||
}
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_wiiu_deinit(void *data)
|
||||
|
@ -627,6 +627,10 @@ static void frontend_win32_environment_get(int *argc, char *argv[],
|
||||
":\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_LOGS],
|
||||
":\\logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t frontend_win32_get_total_mem(void)
|
||||
|
@ -227,6 +227,8 @@ exit:
|
||||
else
|
||||
verbosity_disable();
|
||||
#endif
|
||||
|
||||
dir_check_defaults("custom.ini");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../dynamic.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
static void frontend_xenon_init(void *data)
|
||||
{
|
||||
|
@ -123,8 +123,10 @@ static void salamander_init(char *s, size_t len)
|
||||
const char *rarch_config_path = g_defaults.path_config;
|
||||
bool config_valid = false;
|
||||
char config_path[PATH_MAX_LENGTH];
|
||||
char config_dir[PATH_MAX_LENGTH];
|
||||
|
||||
config_path[0] = '\0';
|
||||
config_dir[0] = '\0';
|
||||
|
||||
/* Get salamander config file path */
|
||||
if (!string_is_empty(rarch_config_path))
|
||||
@ -135,6 +137,12 @@ static void salamander_init(char *s, size_t len)
|
||||
else
|
||||
strcpy_literal(config_path, FILE_PATH_SALAMANDER_CONFIG);
|
||||
|
||||
/* Ensure that config directory exists */
|
||||
fill_pathname_parent_dir(config_dir, config_path, sizeof(config_dir));
|
||||
if (!string_is_empty(config_dir) &&
|
||||
!path_is_directory(config_dir))
|
||||
path_mkdir(config_dir);
|
||||
|
||||
/* Attempt to open config file */
|
||||
config = config_file_new_from_path_to_string(config_path);
|
||||
|
||||
|
2
paths.h
2
paths.h
@ -65,7 +65,7 @@ char *dir_get_ptr(enum rarch_dir_type type);
|
||||
|
||||
void dir_set(enum rarch_dir_type type, const char *path);
|
||||
|
||||
void dir_check_defaults(void);
|
||||
void dir_check_defaults(const char *custom_ini_path);
|
||||
|
||||
void path_deinit_savefile(void);
|
||||
|
||||
|
22
retroarch.c
22
retroarch.c
@ -9424,28 +9424,20 @@ void dir_set(enum rarch_dir_type type, const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
void dir_check_defaults(void)
|
||||
void dir_check_defaults(const char *custom_ini_path)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
size_t i;
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
#if defined(ORBIS) || defined(ANDROID)
|
||||
strcpy_literal(path, "host0:app/custom.ini");
|
||||
#elif defined(__WINRT__)
|
||||
fill_pathname_expand_special(path, "~\\custom.ini", MAX_PATH);
|
||||
#else
|
||||
strcpy_literal(path, "custom.ini");
|
||||
#endif
|
||||
if (path_is_valid(path))
|
||||
/* Early return for people with a custom folder setup
|
||||
* so it doesn't create unnecessary directories */
|
||||
if (!string_is_empty(custom_ini_path) &&
|
||||
path_is_valid(custom_ini_path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
@ -648,8 +648,6 @@ static bool content_load(content_ctx_info_t *info,
|
||||
command_event(CMD_EVENT_RESUME, NULL);
|
||||
command_event(CMD_EVENT_VIDEO_SET_ASPECT_RATIO, NULL);
|
||||
|
||||
dir_check_defaults();
|
||||
|
||||
frontend_driver_process_args(rarch_argc_ptr, rarch_argv_ptr);
|
||||
frontend_driver_content_loaded();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user