Only attempt to call dir_check_defaults once per runtime session
when calling the frontend environment get callback - we want to look at the 'default' directories, and then if they don't yet exist, auto-create them so we can store files in them.
This commit is contained in:
parent
02607e6c34
commit
9ee1e33e09
|
@ -89,13 +89,41 @@ static void get_first_valid_core(char* path_return, size_t len)
|
|||
closedir(dir);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void ctr_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
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 +157,9 @@ 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
|
||||
ctr_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ctr_deinit(void* data)
|
||||
|
|
|
@ -332,6 +332,37 @@ static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void darwin_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -500,6 +531,9 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
|||
|
||||
CFRelease(bundle_path);
|
||||
CFRelease(bundle_url);
|
||||
#ifndef IS_SALAMANDER
|
||||
darwin_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_darwin_load_content(void)
|
||||
|
|
|
@ -45,6 +45,37 @@ enum frontend_architecture frontend_dos_get_architecture(void)
|
|||
return FRONTEND_ARCH_X86;
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void dos_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_dos_get_env_settings(int *argc, char *argv[],
|
||||
void *data, void *params_data)
|
||||
{
|
||||
|
@ -105,12 +136,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
|
||||
dos_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_dos_exec(const char *path, bool should_load_game)
|
||||
|
|
|
@ -69,6 +69,35 @@ void cmd_take_screenshot(void)
|
|||
command_event(CMD_EVENT_TAKE_SCREENSHOT, NULL);
|
||||
}
|
||||
|
||||
static void emscripten_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
|
||||
static void frontend_emscripten_get_env(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -150,13 +179,9 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
|
|||
user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
|
||||
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
|
||||
emscripten_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
@ -154,6 +154,35 @@ static void gx_devthread(void *a)
|
|||
|
||||
#ifdef IS_SALAMANDER
|
||||
extern char gx_rom_path[PATH_MAX_LENGTH];
|
||||
#else
|
||||
static void gx_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_gx_get_environment_settings(
|
||||
|
@ -283,6 +312,7 @@ static void frontend_gx_get_environment_settings(
|
|||
}
|
||||
}
|
||||
#endif
|
||||
gx_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,35 @@ int main(int argc, char *argv[])
|
|||
return rarch_main(argc, argv, NULL);
|
||||
}
|
||||
|
||||
static void orbis_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "host0:app/custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
|
||||
static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -210,14 +239,8 @@ static void frontend_orbis_get_environment_settings(int *argc, char *argv[],
|
|||
RARCH_LOG("Auto-start game %s.\n", argv[2]);
|
||||
}
|
||||
}
|
||||
orbis_dir_check_defaults();
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
static void frontend_orbis_deinit(void *data)
|
||||
|
|
|
@ -107,6 +107,37 @@ static void reset_IOP()
|
|||
sbv_patch_disable_prefix_check();
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void ps2_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_ps2_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -140,12 +171,9 @@ 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
|
||||
ps2_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ps2_init(void *data)
|
||||
|
|
|
@ -176,6 +176,37 @@ static void use_app_path(char *content_info_path)
|
|||
"USRDIR", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __PSL1GHT__
|
||||
static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
|
@ -206,6 +237,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|||
verbosity_enable();
|
||||
else
|
||||
verbosity_disable();
|
||||
ps3_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -329,6 +361,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|||
verbosity_enable();
|
||||
else
|
||||
verbosity_disable();
|
||||
ps3_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -80,6 +80,37 @@ char user_path[512];
|
|||
|
||||
static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void psp_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -217,14 +248,8 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||
}
|
||||
}
|
||||
psp_dir_check_defaults();
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
static void frontend_psp_deinit(void *data)
|
||||
|
|
|
@ -51,6 +51,37 @@ static int frontend_qnx_get_rating(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void qnx_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
|
||||
void *data, void *params_data)
|
||||
{
|
||||
|
@ -162,15 +193,11 @@ 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
|
||||
qnx_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
enum frontend_architecture frontend_qnx_get_architecture(void)
|
||||
|
|
|
@ -175,6 +175,35 @@ static void get_first_valid_core(char *path_return, size_t len)
|
|||
closedir(dir);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void switch_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_switch_get_environment_settings(
|
||||
|
@ -276,6 +305,9 @@ 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
|
||||
switch_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_switch_deinit(void *data)
|
||||
|
|
|
@ -1327,6 +1327,41 @@ static void frontend_unix_get_lakka_version(char *s,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void unix_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
#if defined(ANDROID)
|
||||
strcpy_literal(path, "host0:app/custom.ini");
|
||||
#else
|
||||
strcpy_literal(path, "custom.ini");
|
||||
#endif
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_unix_get_env(int *argc,
|
||||
char *argv[], void *data, void *params_data)
|
||||
{
|
||||
|
@ -1853,12 +1888,9 @@ 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
|
||||
unix_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
|
|
|
@ -323,6 +323,37 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void uwp_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
fill_pathname_expand_special(path, "~\\custom.ini", MAX_PATH);
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_uwp_environment_get(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -390,6 +421,9 @@ static void frontend_uwp_environment_get(int *argc, char *argv[],
|
|||
strcpy_literal(g_defaults.settings_menu, "glui");
|
||||
#endif
|
||||
#endif
|
||||
#ifndef IS_SALAMANDER
|
||||
uwp_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t frontend_uwp_get_mem_total(void)
|
||||
|
|
|
@ -96,6 +96,37 @@ static void fix_asset_directory(void)
|
|||
rename(src_path_buf, dst_path_buf);
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void wiiu_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -136,12 +167,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
|
||||
wiiu_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_wiiu_deinit(void *data)
|
||||
|
|
|
@ -565,6 +565,37 @@ static int frontend_win32_parse_drive_list(void *data, bool load_content)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void win32_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_win32_environment_get(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -627,6 +658,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
|
||||
win32_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t frontend_win32_get_total_mem(void)
|
||||
|
|
|
@ -50,6 +50,37 @@
|
|||
|
||||
static enum frontend_fork xdk_fork_mode = FRONTEND_FORK_NONE;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
static void xdk_dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
strcpy_literal(path, "custom.ini");
|
||||
if (path_is_valid(path))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
|
@ -227,6 +258,7 @@ exit:
|
|||
else
|
||||
verbosity_disable();
|
||||
#endif
|
||||
xdk_dir_check_defaults();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
2
paths.h
2
paths.h
|
@ -65,8 +65,6 @@ 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 path_deinit_savefile(void);
|
||||
|
||||
bool path_set(enum rarch_path_type type, const char *path);
|
||||
|
|
35
retroarch.c
35
retroarch.c
|
@ -9424,41 +9424,6 @@ void dir_set(enum rarch_dir_type type, const char *path)
|
|||
}
|
||||
}
|
||||
|
||||
void dir_check_defaults(void)
|
||||
{
|
||||
unsigned i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* 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))
|
||||
return;
|
||||
|
||||
for (i = 0; i < DEFAULT_DIR_LAST; i++)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
const char *dir_path = g_defaults.dirs[i];
|
||||
|
||||
if (string_is_empty(dir_path))
|
||||
continue;
|
||||
|
||||
new_path[0] = '\0';
|
||||
fill_pathname_expand_special(new_path,
|
||||
dir_path, sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
static bool is_accessibility_enabled(struct rarch_state *p_rarch)
|
||||
{
|
||||
|
|
|
@ -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