Update the way default directories are handled

This commit is contained in:
twinaphex 2017-05-23 19:43:58 +02:00
parent 5f0fcce8d0
commit ccba9635b6
16 changed files with 750 additions and 771 deletions

View File

@ -1657,62 +1657,79 @@ static void config_set_defaults(void)
video_driver_default_settings(); video_driver_default_settings();
if (!string_is_empty(g_defaults.dir.wallpapers)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]))
strlcpy(settings->paths.directory_dynamic_wallpapers, strlcpy(settings->paths.directory_dynamic_wallpapers,
g_defaults.dir.wallpapers, sizeof(settings->paths.directory_dynamic_wallpapers)); g_defaults.dirs[DEFAULT_DIR_WALLPAPERS],
if (!string_is_empty(g_defaults.dir.thumbnails)) sizeof(settings->paths.directory_dynamic_wallpapers));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]))
strlcpy(settings->paths.directory_thumbnails, strlcpy(settings->paths.directory_thumbnails,
g_defaults.dir.thumbnails, sizeof(settings->paths.directory_thumbnails)); g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
if (!string_is_empty(g_defaults.dir.remap)) sizeof(settings->paths.directory_thumbnails));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_REMAP]))
strlcpy(settings->paths.directory_input_remapping, strlcpy(settings->paths.directory_input_remapping,
g_defaults.dir.remap, sizeof(settings->paths.directory_input_remapping)); g_defaults.dirs[DEFAULT_DIR_REMAP],
if (!string_is_empty(g_defaults.dir.cache)) sizeof(settings->paths.directory_input_remapping));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CACHE]))
strlcpy(settings->paths.directory_cache, strlcpy(settings->paths.directory_cache,
g_defaults.dir.cache, sizeof(settings->paths.directory_cache)); g_defaults.dirs[DEFAULT_DIR_CACHE],
if (!string_is_empty(g_defaults.dir.assets)) sizeof(settings->paths.directory_cache));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_ASSETS]))
strlcpy(settings->paths.directory_assets, strlcpy(settings->paths.directory_assets,
g_defaults.dir.assets, sizeof(settings->paths.directory_assets)); g_defaults.dirs[DEFAULT_DIR_ASSETS],
if (!string_is_empty(g_defaults.dir.core_assets)) sizeof(settings->paths.directory_assets));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]))
strlcpy(settings->paths.directory_core_assets, strlcpy(settings->paths.directory_core_assets,
g_defaults.dir.core_assets, sizeof(settings->paths.directory_core_assets)); g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
if (!string_is_empty(g_defaults.dir.playlist)) sizeof(settings->paths.directory_core_assets));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]))
strlcpy(settings->paths.directory_playlist, strlcpy(settings->paths.directory_playlist,
g_defaults.dir.playlist, sizeof(settings->paths.directory_playlist)); g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
if (!string_is_empty(g_defaults.dir.core)) sizeof(settings->paths.directory_playlist));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CORE]))
fill_pathname_expand_special(settings->paths.directory_libretro, fill_pathname_expand_special(settings->paths.directory_libretro,
g_defaults.dir.core, sizeof(settings->paths.directory_libretro)); g_defaults.dirs[DEFAULT_DIR_CORE],
if (!string_is_empty(g_defaults.dir.audio_filter)) sizeof(settings->paths.directory_libretro));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]))
strlcpy(settings->paths.directory_audio_filter, strlcpy(settings->paths.directory_audio_filter,
g_defaults.dir.audio_filter, sizeof(settings->paths.directory_audio_filter)); g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER],
if (!string_is_empty(g_defaults.dir.video_filter)) sizeof(settings->paths.directory_audio_filter));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]))
strlcpy(settings->paths.directory_video_filter, strlcpy(settings->paths.directory_video_filter,
g_defaults.dir.video_filter, sizeof(settings->paths.directory_video_filter)); g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
if (!string_is_empty(g_defaults.dir.shader)) sizeof(settings->paths.directory_video_filter));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_SHADER]))
fill_pathname_expand_special(settings->paths.directory_video_shader, fill_pathname_expand_special(settings->paths.directory_video_shader,
g_defaults.dir.shader, sizeof(settings->paths.directory_video_shader)); g_defaults.dirs[DEFAULT_DIR_SHADER],
sizeof(settings->paths.directory_video_shader));
if (!string_is_empty(g_defaults.path.buildbot_server_url)) if (!string_is_empty(g_defaults.path.buildbot_server_url))
strlcpy(settings->paths.network_buildbot_url, strlcpy(settings->paths.network_buildbot_url,
g_defaults.path.buildbot_server_url, sizeof(settings->paths.network_buildbot_url)); g_defaults.path.buildbot_server_url,
sizeof(settings->paths.network_buildbot_url));
if (!string_is_empty(g_defaults.path.core)) if (!string_is_empty(g_defaults.path.core))
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, g_defaults.path.core); rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, g_defaults.path.core);
if (!string_is_empty(g_defaults.dir.database)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_DATABASE]))
strlcpy(settings->paths.path_content_database, g_defaults.dir.database, strlcpy(settings->paths.path_content_database,
g_defaults.dirs[DEFAULT_DIR_DATABASE],
sizeof(settings->paths.path_content_database)); sizeof(settings->paths.path_content_database));
if (!string_is_empty(g_defaults.dir.cursor)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CURSOR]))
strlcpy(settings->paths.directory_cursor, g_defaults.dir.cursor, strlcpy(settings->paths.directory_cursor,
g_defaults.dirs[DEFAULT_DIR_CURSOR],
sizeof(settings->paths.directory_cursor)); sizeof(settings->paths.directory_cursor));
if (!string_is_empty(g_defaults.dir.cheats)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CHEATS]))
strlcpy(settings->paths.path_cheat_database, g_defaults.dir.cheats, strlcpy(settings->paths.path_cheat_database,
g_defaults.dirs[DEFAULT_DIR_CHEATS],
sizeof(settings->paths.path_cheat_database)); sizeof(settings->paths.path_cheat_database));
if (!string_is_empty(g_defaults.dir.core_info)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]))
fill_pathname_expand_special(settings->paths.path_libretro_info, fill_pathname_expand_special(settings->paths.path_libretro_info,
g_defaults.dir.core_info, sizeof(settings->paths.path_libretro_info)); g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
sizeof(settings->paths.path_libretro_info));
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (!string_is_empty(g_defaults.dir.overlay)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_OVERLAY]))
{ {
fill_pathname_expand_special(settings->paths.directory_overlay, fill_pathname_expand_special(settings->paths.directory_overlay,
g_defaults.dir.overlay, sizeof(settings->paths.directory_overlay)); g_defaults.dirs[DEFAULT_DIR_OVERLAY],
sizeof(settings->paths.directory_overlay));
#ifdef RARCH_MOBILE #ifdef RARCH_MOBILE
if (string_is_empty(settings->paths.path_overlay)) if (string_is_empty(settings->paths.path_overlay))
fill_pathname_join(settings->paths.path_overlay, fill_pathname_join(settings->paths.path_overlay,
@ -1724,10 +1741,10 @@ static void config_set_defaults(void)
#endif #endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (!string_is_empty(g_defaults.dir.menu_config)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]))
{ {
strlcpy(settings->paths.directory_menu_config, strlcpy(settings->paths.directory_menu_config,
g_defaults.dir.menu_config, g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
sizeof(settings->paths.directory_menu_config)); sizeof(settings->paths.directory_menu_config));
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
path_set(RARCH_PATH_CONFIG, path_set(RARCH_PATH_CONFIG,
@ -1735,38 +1752,39 @@ static void config_set_defaults(void)
#endif #endif
} }
if (!string_is_empty(g_defaults.dir.menu_content)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT]))
strlcpy(settings->paths.directory_menu_content, strlcpy(settings->paths.directory_menu_content,
g_defaults.dir.menu_content, g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT],
sizeof(settings->paths.directory_menu_content)); sizeof(settings->paths.directory_menu_content));
#endif #endif
if (!string_is_empty(g_defaults.dir.autoconfig)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]))
strlcpy(settings->paths.directory_autoconfig, strlcpy(settings->paths.directory_autoconfig,
g_defaults.dir.autoconfig, g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
sizeof(settings->paths.directory_autoconfig)); sizeof(settings->paths.directory_autoconfig));
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) && if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
!string_is_empty(g_defaults.dir.savestate)) !string_is_empty(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]))
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate); dir_set(RARCH_DIR_SAVESTATE, g_defaults.dirs[DEFAULT_DIR_SAVESTATE]);
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) && if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
!string_is_empty(g_defaults.dir.sram)) !string_is_empty(g_defaults.dirs[DEFAULT_DIR_SRAM]))
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dir.sram); dir_set(RARCH_DIR_SAVEFILE, g_defaults.dirs[DEFAULT_DIR_SRAM]);
if (!string_is_empty(g_defaults.dir.system)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_SYSTEM]))
strlcpy(settings->paths.directory_system, strlcpy(settings->paths.directory_system,
g_defaults.dir.system, sizeof(settings->paths.directory_system)); g_defaults.dirs[DEFAULT_DIR_SYSTEM],
if (!string_is_empty(g_defaults.dir.screenshot)) sizeof(settings->paths.directory_system));
if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]))
strlcpy(settings->paths.directory_screenshot, strlcpy(settings->paths.directory_screenshot,
g_defaults.dir.screenshot, g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
sizeof(settings->paths.directory_screenshot)); sizeof(settings->paths.directory_screenshot));
if (!string_is_empty(g_defaults.dir.resampler)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_RESAMPLER]))
strlcpy(settings->paths.directory_resampler, strlcpy(settings->paths.directory_resampler,
g_defaults.dir.resampler, g_defaults.dirs[DEFAULT_DIR_RESAMPLER],
sizeof(settings->paths.directory_resampler)); sizeof(settings->paths.directory_resampler));
if (!string_is_empty(g_defaults.dir.content_history)) if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]))
strlcpy(settings->paths.directory_content_history, strlcpy(settings->paths.directory_content_history,
g_defaults.dir.content_history, g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
sizeof(settings->paths.directory_content_history)); sizeof(settings->paths.directory_content_history));
if (!string_is_empty(g_defaults.path.config)) if (!string_is_empty(g_defaults.path.config))
@ -2574,7 +2592,7 @@ static bool config_load_file(const char *path, bool set_defaults,
config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str))) config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
{ {
if (string_is_equal_fast(tmp_str, "default", 7)) if (string_is_equal_fast(tmp_str, "default", 7))
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dir.sram); dir_set(RARCH_DIR_SAVEFILE, g_defaults.dirs[DEFAULT_DIR_SRAM]);
else if (path_is_directory(tmp_str)) else if (path_is_directory(tmp_str))
{ {
@ -2600,7 +2618,7 @@ static bool config_load_file(const char *path, bool set_defaults,
config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str))) config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
{ {
if (string_is_equal_fast(tmp_str, "default", 7)) if (string_is_equal_fast(tmp_str, "default", 7))
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate); dir_set(RARCH_DIR_SAVESTATE, g_defaults.dirs[DEFAULT_DIR_SAVESTATE]);
else if (path_is_directory(tmp_str)) else if (path_is_directory(tmp_str))
{ {
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();

View File

@ -24,6 +24,37 @@
#include "playlist.h" #include "playlist.h"
#endif #endif
enum default_dirs
{
DEFAULT_DIR_MENU_CONTENT = 0,
DEFAULT_DIR_CORE_ASSETS,
DEFAULT_DIR_MENU_CONFIG,
DEFAULT_DIR_AUTOCONFIG,
DEFAULT_DIR_AUDIO_FILTER,
DEFAULT_DIR_VIDEO_FILTER,
DEFAULT_DIR_ASSETS,
DEFAULT_DIR_CORE,
DEFAULT_DIR_CORE_INFO,
DEFAULT_DIR_OVERLAY,
DEFAULT_DIR_PORT,
DEFAULT_DIR_SHADER,
DEFAULT_DIR_SAVESTATE,
DEFAULT_DIR_RESAMPLER,
DEFAULT_DIR_SRAM,
DEFAULT_DIR_SCREENSHOT,
DEFAULT_DIR_SYSTEM,
DEFAULT_DIR_PLAYLIST,
DEFAULT_DIR_CONTENT_HISTORY,
DEFAULT_DIR_REMAP,
DEFAULT_DIR_CACHE,
DEFAULT_DIR_WALLPAPERS,
DEFAULT_DIR_THUMBNAILS,
DEFAULT_DIR_DATABASE,
DEFAULT_DIR_CURSOR,
DEFAULT_DIR_CHEATS,
DEFAULT_DIR_LAST
};
struct defaults struct defaults
{ {
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -50,35 +81,7 @@ struct defaults
bool enable; bool enable;
} overlay; } overlay;
struct char dirs [DEFAULT_DIR_LAST + 1][PATH_MAX_LENGTH];
{
char menu_content[PATH_MAX_LENGTH];
char core_assets[PATH_MAX_LENGTH];
char menu_config[PATH_MAX_LENGTH];
char autoconfig[PATH_MAX_LENGTH];
char audio_filter[PATH_MAX_LENGTH];
char video_filter[PATH_MAX_LENGTH];
char assets[PATH_MAX_LENGTH];
char core[PATH_MAX_LENGTH];
char core_info[PATH_MAX_LENGTH];
char overlay[PATH_MAX_LENGTH];
char port[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
char savestate[PATH_MAX_LENGTH];
char resampler[PATH_MAX_LENGTH];
char sram[PATH_MAX_LENGTH];
char screenshot[PATH_MAX_LENGTH];
char system[PATH_MAX_LENGTH];
char playlist[PATH_MAX_LENGTH];
char content_history[PATH_MAX_LENGTH];
char remap[PATH_MAX_LENGTH];
char cache[PATH_MAX_LENGTH];
char wallpapers[PATH_MAX_LENGTH];
char thumbnails[PATH_MAX_LENGTH];
char database[PATH_MAX_LENGTH];
char cursor[PATH_MAX_LENGTH];
char cheats[PATH_MAX_LENGTH];
} dir;
struct struct
{ {

57
dirs.c
View File

@ -297,60 +297,17 @@ static void check_defaults_dir_create_dir(const char *path)
void dir_check_defaults(void) void dir_check_defaults(void)
{ {
unsigned i;
/* early return for people with a custom folder setup /* early return for people with a custom folder setup
so it doesn't create unnecessary directories so it doesn't create unnecessary directories
*/ */
if (path_file_exists("custom.ini")) if (path_file_exists("custom.ini"))
return; return;
if (!string_is_empty(g_defaults.dir.core_assets)) for (i = 0; i < DEFAULT_DIR_LAST; i++)
check_defaults_dir_create_dir(g_defaults.dir.core_assets); {
if (!string_is_empty(g_defaults.dir.remap)) const char *dir_path = g_defaults.dirs[i];
check_defaults_dir_create_dir(g_defaults.dir.remap); if (!string_is_empty(dir_path))
if (!string_is_empty(g_defaults.dir.screenshot)) check_defaults_dir_create_dir(dir_path);
check_defaults_dir_create_dir(g_defaults.dir.screenshot); }
if (!string_is_empty(g_defaults.dir.core))
check_defaults_dir_create_dir(g_defaults.dir.core);
if (!string_is_empty(g_defaults.dir.autoconfig))
check_defaults_dir_create_dir(g_defaults.dir.autoconfig);
if (!string_is_empty(g_defaults.dir.audio_filter))
check_defaults_dir_create_dir(g_defaults.dir.audio_filter);
if (!string_is_empty(g_defaults.dir.video_filter))
check_defaults_dir_create_dir(g_defaults.dir.video_filter);
if (!string_is_empty(g_defaults.dir.assets))
check_defaults_dir_create_dir(g_defaults.dir.assets);
if (!string_is_empty(g_defaults.dir.playlist))
check_defaults_dir_create_dir(g_defaults.dir.playlist);
if (!string_is_empty(g_defaults.dir.core))
check_defaults_dir_create_dir(g_defaults.dir.core);
if (!string_is_empty(g_defaults.dir.core_info))
check_defaults_dir_create_dir(g_defaults.dir.core_info);
if (!string_is_empty(g_defaults.dir.overlay))
check_defaults_dir_create_dir(g_defaults.dir.overlay);
if (!string_is_empty(g_defaults.dir.port))
check_defaults_dir_create_dir(g_defaults.dir.port);
if (!string_is_empty(g_defaults.dir.shader))
check_defaults_dir_create_dir(g_defaults.dir.shader);
if (!string_is_empty(g_defaults.dir.savestate))
check_defaults_dir_create_dir(g_defaults.dir.savestate);
if (!string_is_empty(g_defaults.dir.sram))
check_defaults_dir_create_dir(g_defaults.dir.sram);
if (!string_is_empty(g_defaults.dir.system))
check_defaults_dir_create_dir(g_defaults.dir.system);
if (!string_is_empty(g_defaults.dir.resampler))
check_defaults_dir_create_dir(g_defaults.dir.resampler);
if (!string_is_empty(g_defaults.dir.menu_config))
check_defaults_dir_create_dir(g_defaults.dir.menu_config);
if (!string_is_empty(g_defaults.dir.content_history))
check_defaults_dir_create_dir(g_defaults.dir.content_history);
if (!string_is_empty(g_defaults.dir.cache))
check_defaults_dir_create_dir(g_defaults.dir.cache);
if (!string_is_empty(g_defaults.dir.database))
check_defaults_dir_create_dir(g_defaults.dir.database);
if (!string_is_empty(g_defaults.dir.cursor))
check_defaults_dir_create_dir(g_defaults.dir.cursor);
if (!string_is_empty(g_defaults.dir.cheats))
check_defaults_dir_create_dir(g_defaults.dir.cheats);
if (!string_is_empty(g_defaults.dir.thumbnails))
check_defaults_dir_create_dir(g_defaults.dir.thumbnails);
} }

View File

@ -64,36 +64,36 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
#endif #endif
#endif #endif
fill_pathname_basedir(g_defaults.dir.port, elf_path_cst, sizeof(g_defaults.dir.port)); 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.dir.port); RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
fill_pathname_join(g_defaults.dir.core_assets, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
"downloads", sizeof(g_defaults.dir.core_assets)); "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
"media", sizeof(g_defaults.dir.assets)); "media", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"cores", sizeof(g_defaults.dir.core)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_CORE],
"info", sizeof(g_defaults.dir.core_info)); "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], g_defaults.dirs[DEFAULT_DIR_CORE],
"savestates", sizeof(g_defaults.dir.savestate)); "savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], g_defaults.dirs[DEFAULT_DIR_CORE],
"savefiles", sizeof(g_defaults.dir.sram)); "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], g_defaults.dirs[DEFAULT_DIR_CORE],
"system", sizeof(g_defaults.dir.system)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], g_defaults.dirs[DEFAULT_DIR_CORE],
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.menu_config, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], g_defaults.dirs[DEFAULT_DIR_PORT],
"config", sizeof(g_defaults.dir.menu_config)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_PORT],
"config/remaps", sizeof(g_defaults.dir.remap)); "config/remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.video_filter, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], g_defaults.dirs[DEFAULT_DIR_PORT],
"filters", sizeof(g_defaults.dir.remap)); "filters", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.database, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], g_defaults.dirs[DEFAULT_DIR_PORT],
"database/rdb", sizeof(g_defaults.dir.database)); "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.cursor, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], g_defaults.dirs[DEFAULT_DIR_PORT],
"database/cursors", sizeof(g_defaults.dir.cursor)); "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
} }

View File

@ -332,37 +332,41 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
CFStringGetCString(bundle_path, bundle_path_buf, sizeof(bundle_path_buf), kCFStringEncodingUTF8); CFStringGetCString(bundle_path, bundle_path_buf, sizeof(bundle_path_buf), kCFStringEncodingUTF8);
(void)home_dir_buf; (void)home_dir_buf;
CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf)); CFSearchPathForDirectoriesInDomains(CFDocumentDirectory,
CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf));
strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf)); strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf));
fill_pathname_join(g_defaults.dir.shader, home_dir_buf, "shaders_glsl", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER],
home_dir_buf, "shaders_glsl",
sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
int major, minor; int major, minor;
get_ios_version(&major, &minor); get_ios_version(&major, &minor);
if (major >= 10 ) { if (major >= 10 )
fill_pathname_join(g_defaults.dir.core, bundle_path_buf, "modules", sizeof(g_defaults.dir.core)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
} else { bundle_path_buf, "modules", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core, home_dir_buf, "cores", sizeof(g_defaults.dir.core)); else
} fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
home_dir_buf, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
#else #else
fill_pathname_join(g_defaults.dir.core, home_dir_buf, "cores", sizeof(g_defaults.dir.core)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], home_dir_buf, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
#endif #endif
fill_pathname_join(g_defaults.dir.core_info, home_dir_buf, "info", sizeof(g_defaults.dir.core_info)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], home_dir_buf, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.overlay, home_dir_buf, "overlays", sizeof(g_defaults.dir.overlay)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], home_dir_buf, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.autoconfig, home_dir_buf, "autoconfig", sizeof(g_defaults.dir.autoconfig)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], home_dir_buf, "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.core_assets, home_dir_buf, "downloads", sizeof(g_defaults.dir.core_assets)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], home_dir_buf, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.assets, home_dir_buf, "assets", sizeof(g_defaults.dir.assets)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], home_dir_buf, "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.system, home_dir_buf, "system", sizeof(g_defaults.dir.system)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], home_dir_buf, "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.menu_config, home_dir_buf, "config", sizeof(g_defaults.dir.menu_config)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], home_dir_buf, "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.database, home_dir_buf, "database/rdb", sizeof(g_defaults.dir.database)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], home_dir_buf, "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.cursor, home_dir_buf, "database/cursors", sizeof(g_defaults.dir.cursor)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], home_dir_buf, "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.cheats, home_dir_buf, "cht", sizeof(g_defaults.dir.cheats)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], home_dir_buf, "cht", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.thumbnails, home_dir_buf, "thumbnails", sizeof(g_defaults.dir.thumbnails)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], home_dir_buf, "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dir.sram, home_dir_buf, "saves", sizeof(g_defaults.dir.sram)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], home_dir_buf, "saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, home_dir_buf, "states", sizeof(g_defaults.dir.savestate)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], home_dir_buf, "states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
#if defined(IOS) #if defined(IOS)
fill_pathname_join(g_defaults.dir.playlist, home_dir_buf, "playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], home_dir_buf, "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
#endif #endif
#if defined(OSX) #if defined(OSX)
char application_data[PATH_MAX_LENGTH]; char application_data[PATH_MAX_LENGTH];
@ -370,26 +374,26 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
fill_pathname_application_data(application_data, sizeof(application_data)); fill_pathname_application_data(application_data, sizeof(application_data));
#ifdef HAVE_CG #ifdef HAVE_CG
fill_pathname_join(g_defaults.dir.shader, home_dir_buf, "shaders_cg", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], home_dir_buf, "shaders_cg", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
#endif #endif
fill_pathname_join(g_defaults.dir.audio_filter, home_dir_buf, "audio_filters", sizeof(g_defaults.dir.audio_filter)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], home_dir_buf, "audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
fill_pathname_join(g_defaults.dir.video_filter, home_dir_buf, "video_filters", sizeof(g_defaults.dir.video_filter)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], home_dir_buf, "video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
fill_pathname_join(g_defaults.dir.playlist, application_data, "playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], application_data, "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.thumbnails, application_data, "thumbnails", sizeof(g_defaults.dir.thumbnails)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], application_data, "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dir.menu_config, application_data, "config", sizeof(g_defaults.dir.menu_config)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], application_data, "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.core_assets, application_data, "downloads", sizeof(g_defaults.dir.core_assets)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE]_assets, application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]_assets));
fill_pathname_join(g_defaults.dir.screenshot, application_data, "screenshots", sizeof(g_defaults.dir.screenshot)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], application_data, "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
#if defined(RELEASE_BUILD) #if defined(RELEASE_BUILD)
fill_pathname_join(g_defaults.dir.shader, bundle_path_buf, "Contents/Resources/shaders", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], bundle_path_buf, "Contents/Resources/shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.dir.core, bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dir.core)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core_info, bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dir.core_info)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.overlay, bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dir.overlay)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.autoconfig, bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dir.autoconfig)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.assets, bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dir.assets)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.database, bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dir.database)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.cursor, bundle_path_buf, "Contents/Resources/database/cursors", sizeof(g_defaults.dir.cursor)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], bundle_path_buf, "Contents/Resources/database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.cheats, bundle_path_buf, "Contents/Resources/cht", sizeof(g_defaults.dir.cheats)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], bundle_path_buf, "Contents/Resources/cht", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
#endif #endif
#endif #endif
@ -413,7 +417,9 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
#endif #endif
CFTemporaryDirectory(temp_dir, sizeof(temp_dir)); CFTemporaryDirectory(temp_dir, sizeof(temp_dir));
strlcpy(g_defaults.dir.cache, temp_dir, sizeof(g_defaults.dir.cache)); strlcpy(g_defaults.dirs[DEFAULT_DIR_CACHE],
temp_dir,
sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
path_mkdir(bundle_path_buf); path_mkdir(bundle_path_buf);
@ -421,12 +427,13 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
RARCH_ERR("Failed to create or access base directory: %s\n", bundle_path_buf); RARCH_ERR("Failed to create or access base directory: %s\n", bundle_path_buf);
else else
{ {
path_mkdir(g_defaults.dir.system); path_mkdir(g_defaults.dirs[DEFAULT_DIR_SYSTEM]);
if (access(g_defaults.dir.system, 0755) != 0) if (access(g_defaults.dirs[DEFAULT_DIR_SYSTEM], 0755) != 0)
RARCH_ERR("Failed to create or access system directory: %s.\n", g_defaults.dir.system); RARCH_ERR("Failed to create or access system directory: %s.\n", g_defaults.dirs[DEFAULT_DIR_SYSTEM]);
} }
CFRelease(bundle_path); CFRelease(bundle_path);
CFRelease(bundle_url); CFRelease(bundle_url);
} }

View File

@ -83,6 +83,7 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
{ {
(void)args; (void)args;
unsigned i;
char base_path[PATH_MAX] = {0}; char base_path[PATH_MAX] = {0};
char user_path[PATH_MAX] = {0}; char user_path[PATH_MAX] = {0};
const char *home = getenv("HOME"); const char *home = getenv("HOME");
@ -100,74 +101,65 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
snprintf(user_path, sizeof(user_path), "retroarch/userdata"); snprintf(user_path, sizeof(user_path), "retroarch/userdata");
} }
fill_pathname_join(g_defaults.dir.core, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], base_path,
"cores", sizeof(g_defaults.dir.core)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
/* bundle data */ /* bundle data */
fill_pathname_join(g_defaults.dir.assets, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], base_path,
"bundle/assets", sizeof(g_defaults.dir.assets)); "bundle/assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.autoconfig, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], base_path,
"bundle/autoconfig", sizeof(g_defaults.dir.autoconfig)); "bundle/autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.cursor, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], base_path,
"bundle/database/cursors", sizeof(g_defaults.dir.cursor)); "bundle/database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.database, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], base_path,
"bundle/database/rdb", sizeof(g_defaults.dir.database)); "bundle/database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.core_info, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], base_path,
"bundle/info", sizeof(g_defaults.dir.core_info)); "bundle/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.overlay, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path,
"bundle/overlays", sizeof(g_defaults.dir.overlay)); "bundle/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.shader, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], base_path,
"bundle/shaders", sizeof(g_defaults.dir.shader)); "bundle/shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
/* user data dirs */ /* user data dirs */
fill_pathname_join(g_defaults.dir.cheats, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"cheats", sizeof(g_defaults.dir.cheats)); "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.menu_config, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"config", sizeof(g_defaults.dir.menu_config)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.menu_content, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT], user_path,
"content", sizeof(g_defaults.dir.menu_content)); "content", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT]));
fill_pathname_join(g_defaults.dir.core_assets, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"content/downloads", sizeof(g_defaults.dir.core_assets)); "content/downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.playlist, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
"remaps", sizeof(g_defaults.dir.remap)); "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.sram, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"saves", sizeof(g_defaults.dir.sram)); "saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.screenshot, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], user_path,
"screenshots", sizeof(g_defaults.dir.screenshot)); "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dir.savestate, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"states", sizeof(g_defaults.dir.savestate)); "states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"system", sizeof(g_defaults.dir.system)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.thumbnails, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
"thumbnails", sizeof(g_defaults.dir.thumbnails)); "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
/* cache dir */ /* cache dir */
fill_pathname_join(g_defaults.dir.cache, "/tmp/", fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], "/tmp/",
"retroarch", sizeof(g_defaults.dir.cache)); "retroarch", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
/* history and main config */ /* history and main config */
strlcpy(g_defaults.dir.content_history, strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dir.content_history)); user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.path.config, user_path, fill_pathname_join(g_defaults.path.config, user_path,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
/* create user data dirs */ for (i = 0; i < DEFAULT_DIR_LAST; i++)
path_mkdir(g_defaults.dir.cheats); {
path_mkdir(g_defaults.dir.core_assets); const char *dir_path = g_defaults.dirs[i];
path_mkdir(g_defaults.dir.menu_config); if (!string_is_empty(dir_path))
path_mkdir(g_defaults.dir.menu_content); check_defaults_dir_create_dir(dir_path);
path_mkdir(g_defaults.dir.playlist); }
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.screenshot);
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.system);
path_mkdir(g_defaults.dir.thumbnails);
/* create cache dir */
path_mkdir(g_defaults.dir.cache);
snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "rgui"); snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "rgui");
} }

View File

@ -207,37 +207,37 @@ static void frontend_gx_get_environment_settings(
#ifdef HW_DOL #ifdef HW_DOL
chdir("carda:/retroarch"); chdir("carda:/retroarch");
#endif #endif
getcwd(g_defaults.dir.core, PATH_MAX_LENGTH); getcwd(g_defaults.dirs[DEFAULT_DIR_CORE], PATH_MAX_LENGTH);
last_slash = strrchr(g_defaults.dir.core, '/'); last_slash = strrchr(g_defaults.dirs[DEFAULT_DIR_CORE], '/');
if (last_slash) if (last_slash)
*last_slash = 0; *last_slash = 0;
device_end = strchr(g_defaults.dir.core, '/'); device_end = strchr(g_defaults.dirs[DEFAULT_DIR_CORE], '/');
if (device_end) if (device_end)
snprintf(g_defaults.dir.port, sizeof(g_defaults.dir.port), snprintf(g_defaults.dirs[DEFAULT_DIR_PORT], sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]),
"%.*s/retroarch", device_end - g_defaults.dir.core, "%.*s/retroarch", device_end - g_defaults.dirs[DEFAULT_DIR_CORE],
g_defaults.dir.core); g_defaults.dirs[DEFAULT_DIR_CORE]);
else else
fill_pathname_join(g_defaults.dir.port, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PORT], g_defaults.dirs[DEFAULT_DIR_PORT],
"retroarch", sizeof(g_defaults.dir.port)); "retroarch", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_CORE],
"info", sizeof(g_defaults.dir.core_info)); "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.autoconfig, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
g_defaults.dir.core, "autoconfig", g_defaults.dirs[DEFAULT_DIR_CORE], "autoconfig",
sizeof(g_defaults.dir.autoconfig)); sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.overlay, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_CORE],
"overlays", sizeof(g_defaults.dir.overlay)); "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
"retroarch.cfg", sizeof(g_defaults.path.config)); "retroarch.cfg", sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], g_defaults.dirs[DEFAULT_DIR_PORT],
"system", sizeof(g_defaults.dir.system)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], g_defaults.dirs[DEFAULT_DIR_PORT],
"savefiles", sizeof(g_defaults.dir.sram)); "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], g_defaults.dirs[DEFAULT_DIR_PORT],
"savefiles", sizeof(g_defaults.dir.savestate)); "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], g_defaults.dirs[DEFAULT_DIR_PORT],
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
#ifdef IS_SALAMANDER #ifdef IS_SALAMANDER
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL) if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
@ -387,7 +387,7 @@ static void frontend_gx_exitspawn(char *s, size_t len)
if (frontend_driver_get_salamander_basename(salamander_name, if (frontend_driver_get_salamander_basename(salamander_name,
sizeof(salamander_name))) sizeof(salamander_name)))
{ {
fill_pathname_join(new_path, g_defaults.dir.core, fill_pathname_join(new_path, g_defaults.dirs[DEFAULT_DIR_CORE],
salamander_name, sizeof(new_path)); salamander_name, sizeof(new_path));
path_set(RARCH_PATH_CONTENT, new_path); path_set(RARCH_PATH_CONTENT, new_path);
} }
@ -406,7 +406,7 @@ static void frontend_gx_exitspawn(char *s, size_t len)
* direct loading failed (out of memory), * direct loading failed (out of memory),
* try to jump to Salamander, * try to jump to Salamander,
* then load the correct core */ * then load the correct core */
fill_pathname_join(s, g_defaults.dir.core, fill_pathname_join(s, g_defaults.dirs[DEFAULT_DIR_CORE],
salamander_basename, len); salamander_basename, len);
#endif #endif
frontend_gx_exec(s, should_load_game); frontend_gx_exec(s, should_load_game);

View File

@ -1235,6 +1235,7 @@ static void frontend_linux_get_lakka_version(char *s,
static void frontend_linux_get_env(int *argc, static void frontend_linux_get_env(int *argc,
char *argv[], void *data, void *params_data) char *argv[], void *data, void *params_data)
{ {
unsigned i;
#ifdef ANDROID #ifdef ANDROID
int32_t major, minor, rel; int32_t major, minor, rel;
char device_model[PROP_VALUE_MAX] = {0}; char device_model[PROP_VALUE_MAX] = {0};
@ -1518,158 +1519,147 @@ static void frontend_linux_get_env(int *argc,
"RetroArch", "[ENV]: application location: [%s]\n", app_dir); "RetroArch", "[ENV]: application location: [%s]\n", app_dir);
if (args && *app_dir) if (args && *app_dir)
{ {
fill_pathname_join(g_defaults.dir.assets, app_dir, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], app_dir,
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.cache, app_dir, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], app_dir,
"tmp", sizeof(g_defaults.dir.cache)); "tmp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
fill_pathname_join(g_defaults.dir.shader, app_dir, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], app_dir,
"shaders", sizeof(g_defaults.dir.shader)); "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.dir.overlay, app_dir, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], app_dir,
"overlays", sizeof(g_defaults.dir.overlay)); "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.core, app_dir, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], app_dir,
"cores", sizeof(g_defaults.dir.core)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core_info, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
app_dir, "info", sizeof(g_defaults.dir.core_info)); app_dir, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.autoconfig, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
app_dir, "autoconfig", sizeof(g_defaults.dir.autoconfig)); app_dir, "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.audio_filter, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER],
app_dir, "filters/audio", sizeof(g_defaults.dir.audio_filter)); app_dir, "filters/audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
fill_pathname_join(g_defaults.dir.video_filter, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
app_dir, "filters/video", sizeof(g_defaults.dir.video_filter)); app_dir, "filters/video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
strlcpy(g_defaults.dir.content_history, strlcpy(g_defualts.dirs[DEFAULT_DIR_CONTENT_HISTORY],
app_dir, sizeof(g_defaults.dir.content_history)); app_dir, sizeof(g_defualts.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.dir.database, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE],
app_dir, "database/rdb", sizeof(g_defaults.dir.database)); app_dir, "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.cursor, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR],
app_dir, "database/cursors", sizeof(g_defaults.dir.cursor)); app_dir, "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.wallpapers, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS],
app_dir, "assets/wallpapers", sizeof(g_defaults.dir.wallpapers)); app_dir, "assets/wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]));
if(!string_is_empty(downloads_dir) && test_permissions(downloads_dir)) if(!string_is_empty(downloads_dir) && test_permissions(downloads_dir))
{ {
fill_pathname_join(g_defaults.dir.core_assets, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
downloads_dir, "", sizeof(g_defaults.dir.core_assets)); downloads_dir, "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
} }
else else
{ {
fill_pathname_join(g_defaults.dir.core_assets, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
app_dir, "downloads", sizeof(g_defaults.dir.core_assets)); app_dir, "downloads",
path_mkdir(g_defaults.dir.core_assets); sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
} }
__android_log_print(ANDROID_LOG_INFO, __android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default download folder: [%s]", "RetroArch", "[ENV]: default download folder: [%s]",
g_defaults.dir.core_assets); g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]);
switch (perms) switch (perms)
{ {
/* Set defaults for this since we can't guarantee saving on content dir will /* Set defaults for this since we can't guarantee saving on content dir will
work in this case */ work in this case */
case INTERNAL_STORAGE_APPDIR_WRITABLE: case INTERNAL_STORAGE_APPDIR_WRITABLE:
fill_pathname_join(g_defaults.dir.sram, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
internal_storage_app_path, "saves", sizeof(g_defaults.dir.sram)); internal_storage_app_path, "saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
internal_storage_app_path, "states", sizeof(g_defaults.dir.savestate)); internal_storage_app_path, "states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
internal_storage_app_path, "system", sizeof(g_defaults.dir.system)); internal_storage_app_path, "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.menu_config, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
internal_storage_app_path, "config", sizeof(g_defaults.dir.menu_config)); internal_storage_app_path, "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.thumbnails, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
internal_storage_app_path, "thumbnails", sizeof(g_defaults.dir.thumbnails)); internal_storage_app_path, "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dir.playlist, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
internal_storage_app_path, "playlists", sizeof(g_defaults.dir.playlist)); internal_storage_app_path, "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.cheats, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
internal_storage_app_path, "cheats", sizeof(g_defaults.dir.cheats)); internal_storage_app_path, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir)) if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir))
{ {
fill_pathname_join(g_defaults.dir.screenshot, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
screenshot_dir, "", sizeof(g_defaults.dir.screenshot)); screenshot_dir, "", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
} }
else else
{ {
fill_pathname_join(g_defaults.dir.screenshot, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
internal_storage_app_path, "screenshots", sizeof(g_defaults.dir.screenshot)); internal_storage_app_path, "screenshots",
path_mkdir(g_defaults.dir.screenshot); sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
} }
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.system);
break; break;
case INTERNAL_STORAGE_NOT_WRITABLE: case INTERNAL_STORAGE_NOT_WRITABLE:
/* Set defaults for this since we can't guarantee saving on content dir will /* Set defaults for this since we can't guarantee saving on content dir will
work in this case */ work in this case */
fill_pathname_join(g_defaults.dir.sram, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
app_dir, "saves", sizeof(g_defaults.dir.sram)); app_dir, "saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
app_dir, "states", sizeof(g_defaults.dir.savestate)); app_dir, "states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
app_dir, "system", sizeof(g_defaults.dir.system)); app_dir, "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.menu_config, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
app_dir, "config", sizeof(g_defaults.dir.menu_config)); app_dir, "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.thumbnails, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
app_dir, "thumbnails", sizeof(g_defaults.dir.thumbnails)); app_dir, "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dir.playlist, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
app_dir, "playlists", sizeof(g_defaults.dir.playlist)); app_dir, "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.cheats, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
app_dir, "cheats", sizeof(g_defaults.dir.cheats)); app_dir, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir)) if(!string_is_empty(screenshot_dir) && test_permissions(screenshot_dir))
{ {
fill_pathname_join(g_defaults.dir.screenshot, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
screenshot_dir, "", sizeof(g_defaults.dir.screenshot)); screenshot_dir, "", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
} }
else else
{ {
fill_pathname_join(g_defaults.dir.screenshot, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
app_dir, "screenshots", sizeof(g_defaults.dir.screenshot)); app_dir, "screenshots",
path_mkdir(g_defaults.dir.screenshot); sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
} }
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.system);
break; break;
case INTERNAL_STORAGE_WRITABLE: case INTERNAL_STORAGE_WRITABLE:
/* Don't set defaults for saves, states, system or screenshots /* Don't set defaults for saves, states, system or screenshots
in this case to be able to honour saving on content dir */ in this case to be able to honour saving on content dir */
fill_pathname_join(g_defaults.dir.menu_config, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
internal_storage_path, "RetroArch/config", sizeof(g_defaults.dir.menu_config)); internal_storage_path, "RetroArch/config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap)); g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.thumbnails, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
internal_storage_path, "RetroArch/thumbnails", sizeof(g_defaults.dir.thumbnails)); internal_storage_path, "RetroArch/thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dir.playlist, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
internal_storage_path, "RetroArch/playlists", sizeof(g_defaults.dir.playlist)); internal_storage_path, "RetroArch/playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.cheats, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
internal_storage_path, "RetroArch/cheats", sizeof(g_defaults.dir.cheats)); internal_storage_path, "RetroArch/cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
default: default:
break; break;
} }
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.thumbnails);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.cheats);
__android_log_print(ANDROID_LOG_INFO, __android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default savefile folder: [%s]", "RetroArch", "[ENV]: default savefile folder: [%s]",
g_defaults.dir.sram); g_defaults.dirs[DEFAULT_DIR_SRAM]);
__android_log_print(ANDROID_LOG_INFO, __android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default savestate folder: [%s]", "RetroArch", "[ENV]: default savestate folder: [%s]",
g_defaults.dir.savestate); g_defaults.dirs[DEFAULT_DIR_SAVESTATE]);
__android_log_print(ANDROID_LOG_INFO, __android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default system folder: [%s]", "RetroArch", "[ENV]: default system folder: [%s]",
g_defaults.dir.system); g_defaults.dirs[DEFAULT_DIR_SYSTEM]);
__android_log_print(ANDROID_LOG_INFO, __android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default screenshot folder: [%s]", "RetroArch", "[ENV]: default screenshot folder: [%s]",
g_defaults.dir.screenshot); g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]);
} }
} }
} }
@ -1746,52 +1736,59 @@ static void frontend_linux_get_env(int *argc,
else else
snprintf(base_path, sizeof(base_path), "retroarch"); snprintf(base_path, sizeof(base_path), "retroarch");
fill_pathname_join(g_defaults.dir.core, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], base_path,
"cores", sizeof(g_defaults.dir.core)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core_info, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], base_path,
"cores", sizeof(g_defaults.dir.core_info)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.autoconfig, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], base_path,
"autoconfig", sizeof(g_defaults.dir.autoconfig)); "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
if (path_is_directory("/usr/local/share/retroarch/assets")) if (path_is_directory("/usr/local/share/retroarch/assets"))
fill_pathname_join(g_defaults.dir.assets, "/usr/local/share/retroarch", fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], "/usr/local/share/retroarch",
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else if (path_is_directory("/usr/share/retroarch/assets")) else if (path_is_directory("/usr/share/retroarch/assets"))
fill_pathname_join(g_defaults.dir.assets, "/usr/share/retroarch", fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], "/usr/share/retroarch",
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else if (path_is_directory("/usr/local/share/games/retroarch/assets")) else if (path_is_directory("/usr/local/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dir.assets, "/usr/local/share/games/retroarch", fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], "/usr/local/share/games/retroarch",
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else if (path_is_directory("/usr/share/games/retroarch/assets")) else if (path_is_directory("/usr/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dir.assets, "/usr/share/games/retroarch", fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], "/usr/share/games/retroarch",
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else else
fill_pathname_join(g_defaults.dir.assets, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], base_path,
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.menu_config, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], base_path,
"config", sizeof(g_defaults.dir.menu_config)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
"remaps", sizeof(g_defaults.dir.remap)); "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.playlist, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], base_path,
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.cursor, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], base_path,
"database/cursors", sizeof(g_defaults.dir.cursor)); "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.database, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], base_path,
"database/rdb", sizeof(g_defaults.dir.database)); "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.shader, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], base_path,
"shaders", sizeof(g_defaults.dir.shader)); "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.dir.cheats, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], base_path,
"cheats", sizeof(g_defaults.dir.cheats)); "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.overlay, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path,
"overlay", sizeof(g_defaults.dir.overlay)); "overlay", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.core_assets, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], base_path,
"downloads", sizeof(g_defaults.dir.core_assets)); "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.screenshot, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], base_path,
"screenshots", sizeof(g_defaults.dir.screenshot)); "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dir.thumbnails, base_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], base_path,
"thumbnails", sizeof(g_defaults.dir.thumbnails)); "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
#endif #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);
}
} }
#ifdef ANDROID #ifdef ANDROID

View File

@ -193,15 +193,15 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
== CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n"); RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
ret = cellGameContentPermit(content_info_path, g_defaults.dir.port); ret = cellGameContentPermit(content_info_path, g_defaults.dirs[DEFAULT_DIR_PORT]);
#ifdef HAVE_MULTIMAN #ifdef HAVE_MULTIMAN
if (multiman_detected) if (multiman_detected)
{ {
fill_pathname_join(content_info_path, "/dev_hdd0/game/", fill_pathname_join(content_info_path, "/dev_hdd0/game/",
EMULATOR_CONTENT_DIR, sizeof(content_info_path)); EMULATOR_CONTENT_DIR, sizeof(content_info_path));
fill_pathname_join(g_defaults.dir.port, content_info_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PORT], content_info_path,
"USRDIR", sizeof(g_defaults.dir.port)); "USRDIR", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
} }
#endif #endif
@ -211,35 +211,48 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
{ {
RARCH_LOG("cellGameContentPermit() OK.\n"); RARCH_LOG("cellGameContentPermit() OK.\n");
RARCH_LOG("content_info_path : [%s].\n", content_info_path); RARCH_LOG("content_info_path : [%s].\n", content_info_path);
RARCH_LOG("usrDirPath : [%s].\n", g_defaults.dir.port); RARCH_LOG("usrDirPath : [%s].\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
} }
strlcpy(g_defaults.dir.content_history, strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
g_defaults.dir.port, sizeof(g_defaults.dir.content_history)); g_defaults.dirs[DEFAULT_DIR_PORT],
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
"cores", sizeof(g_defaults.dir.core)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, g_defaults.dirs[DEFAULT_DIR_PORT],
"info", sizeof(g_defaults.dir.core_info)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
"savestates", sizeof(g_defaults.dir.savestate)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core, "info",
"savefiles", sizeof(g_defaults.dir.sram)); sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
"system", sizeof(g_defaults.dir.system)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.shader, g_defaults.dir.core, "savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
"shaders_cg", sizeof(g_defaults.dir.shader)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, g_defaults.dirs[DEFAULT_DIR_CORE],
"savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER],
g_defaults.dirs[DEFAULT_DIR_CORE],
"shaders_cg", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.dir.overlay, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
"overlays", sizeof(g_defaults.dir.overlay)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.core, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
"assets", sizeof(g_defaults.dir.assets)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
fill_pathname_join(g_defaults.dir.cursor, g_defaults.dir.core, g_defaults.dirs[DEFAULT_DIR_CORE],
"database/cursors", sizeof(g_defaults.dir.cursor)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.database, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR],
"database/rdb", sizeof(g_defaults.dir.database)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core, "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
"playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE],
g_defaults.dirs[DEFAULT_DIR_CORE],
"database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
g_defaults.dirs[DEFAULT_DIR_CORE],
"playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
} }
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER

View File

@ -81,6 +81,7 @@ static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
static void frontend_psp_get_environment_settings(int *argc, char *argv[], static void frontend_psp_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data) void *args, void *params_data)
{ {
unsigned i;
struct rarch_main_wrap *params = NULL; struct rarch_main_wrap *params = NULL;
(void)args; (void)args;
@ -99,129 +100,93 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
#ifdef VITA #ifdef VITA
strlcpy(eboot_path, "app0:/", sizeof(eboot_path)); strlcpy(eboot_path, "app0:/", sizeof(eboot_path));
strlcpy(g_defaults.dir.port, eboot_path, sizeof(g_defaults.dir.port)); strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
strlcpy(user_path, "ux0:/data/retroarch/", sizeof(user_path)); strlcpy(user_path, "ux0:/data/retroarch/", sizeof(user_path));
#else #else
strlcpy(eboot_path, argv[0], sizeof(eboot_path)); strlcpy(eboot_path, argv[0], sizeof(eboot_path));
/* for PSP, use uppercase directories, and no trailing slashes /* for PSP, use uppercase directories, and no trailing slashes
otherwise mkdir fails */ otherwise mkdir fails */
strlcpy(user_path, "ms0:/PSP/RETROARCH", sizeof(user_path)); strlcpy(user_path, "ms0:/PSP/RETROARCH", sizeof(user_path));
fill_pathname_basedir(g_defaults.dir.port, argv[0], sizeof(g_defaults.dir.port)); fill_pathname_basedir(g_defaults.dirs[DEFAULT_DIR_PORT], argv[0], sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
#endif #endif
RARCH_LOG("port dir: [%s]\n", g_defaults.dir.port); RARCH_LOG("port dir: [%s]\n", g_defaults.dirs[DEFAULT_DIR_PORT]);
#ifdef VITA #ifdef VITA
/* bundle data*/ /* bundle data*/
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"", sizeof(g_defaults.dir.core)); "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_CORE],
"info", sizeof(g_defaults.dir.core_info)); "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.database, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], g_defaults.dirs[DEFAULT_DIR_PORT],
"database/rdb", sizeof(g_defaults.dir.database)); "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.cursor, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], g_defaults.dirs[DEFAULT_DIR_PORT],
"database/cursors", sizeof(g_defaults.dir.cursor)); "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
/* user data*/ /* user data*/
fill_pathname_join(g_defaults.dir.cheats, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"cheats", sizeof(g_defaults.dir.cheats)); "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.menu_config, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"config", sizeof(g_defaults.dir.menu_config)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.core_assets, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"downloads", sizeof(g_defaults.dir.core_assets)); "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.playlist, user_path, fill_pathname_join(g_default.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_default.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.remap, user_path, fill_pathname_join(g_default.dirs[DEFAULT_DIR_REMAP], user_path,
"remaps", sizeof(g_defaults.dir.remap)); "remaps", sizeof(g_default.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.sram, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"savefiles", sizeof(g_defaults.dir.sram)); "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"savestates", sizeof(g_defaults.dir.savestate)); "savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"system", sizeof(g_defaults.dir.system)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.cache, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path,
"temp", sizeof(g_defaults.dir.cache)); "temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
fill_pathname_join(g_defaults.dir.overlay, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path,
"overlays", sizeof(g_defaults.dir.overlay)); "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.thumbnails, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path,
"thumbnails", sizeof(g_defaults.dir.thumbnails)); "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
strlcpy(g_defaults.dir.content_history, strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dir.content_history)); user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.path.config, user_path, fill_pathname_join(g_defaults.path.config, user_path,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
#else #else
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"CORES", sizeof(g_defaults.dir.core)); "CORES", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_PORT],
"INFO", sizeof(g_defaults.dir.core_info)); "INFO", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
/* bundle data */
/*
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.port,
"BUNDLE/ASSETS", sizeof(g_defaults.dir.assets));
fill_pathname_join(g_defaults.dir.autoconfig, g_defaults.dir.port,
"BUNDLE/AUTOCONFIG", sizeof(g_defaults.dir.autoconfig));
fill_pathname_join(g_defaults.dir.cursor, base_path,
"BUNDLE/DATABASE/CURSORS", sizeof(g_defaults.dir.cursor));
fill_pathname_join(g_defaults.dir.database, base_path,
"BUNDLE/DATABASE/RDB", sizeof(g_defaults.dir.database));
fill_pathname_join(g_defaults.dir.overlay, base_path,
"BUNDLE/OVERLAYS", sizeof(g_defaults.dir.overlay));
fill_pathname_join(g_defaults.dir.shader, base_path,
"BUNDLE/SHADERS", sizeof(g_defaults.dir.shader));
*/
/* user data */ /* user data */
fill_pathname_join(g_defaults.dir.cheats, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"CHEATS", sizeof(g_defaults.dir.cheats)); "CHEATS", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.menu_config, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"CONFIG", sizeof(g_defaults.dir.menu_config)); "CONFIG", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.core_assets, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"DOWNLOADS", sizeof(g_defaults.dir.core_assets)); "DOWNLOADS", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.playlist, user_path, fill_pathname_join(g_default.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"PLAYLISTS", sizeof(g_defaults.dir.playlist)); "PLAYLISTS", sizeof(g_default.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, fill_pathname_join(g_default.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
"REMAPS", sizeof(g_defaults.dir.remap)); "REMAPS", sizeof(g_default.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.sram, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"SAVEFILES", sizeof(g_defaults.dir.sram)); "SAVEFILES", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.savestate, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"SAVESTATES", sizeof(g_defaults.dir.savestate)); "SAVESTATES", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.screenshot, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], user_path,
"SCREENSHOTS", sizeof(g_defaults.dir.screenshot)); "SCREENSHOTS", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dir.system, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"SYSTEM", sizeof(g_defaults.dir.system)); "SYSTEM", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
/* fill_pathname_join(g_defaults.dir.thumbnails, user_path,
"THUMBNAILS", sizeof(g_defaults.dir.thumbnails)); */
/* cache dir */ /* cache dir */
fill_pathname_join(g_defaults.dir.cache, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE], user_path,
"TEMP", sizeof(g_defaults.dir.cache)); "TEMP", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
/* history and main config */ /* history and main config */
strlcpy(g_defaults.dir.content_history, strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dir.content_history)); user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.path.config, user_path, fill_pathname_join(g_defaults.path.config, user_path,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
#endif #endif
/* create user data dirs */
path_mkdir(g_defaults.dir.cheats);
path_mkdir(g_defaults.dir.core_assets);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.menu_config);
path_mkdir(g_defaults.dir.playlist);
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.screenshot);
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.system);
#ifdef VITA
path_mkdir(g_defaults.dir.thumbnails);
#endif
/* create cache dir */
path_mkdir(g_defaults.dir.cache);
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
#ifdef VITA #ifdef VITA
@ -255,6 +220,13 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
} }
} }
#endif #endif
for (i = 0; i < DEFAULT_DIR_LAST; i++)
{
const char *dir_path = g_defaults.dirs[i];
if (!string_is_empty(dir_path))
check_defaults_dir_create_dir(dir_path);
}
} }
static void frontend_psp_deinit(void *data) static void frontend_psp_deinit(void *data)

View File

@ -52,121 +52,117 @@ static int frontend_qnx_get_rating(void)
static void frontend_qnx_get_environment_settings(int *argc, char *argv[], static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
void *data, void *params_data) void *data, void *params_data)
{ {
char assets_path[PATH_MAX] = {0}; unsigned i;
char data_path[PATH_MAX] = {0}; char assets_path[PATH_MAX] = {0};
char user_path[PATH_MAX] = {0}; char data_path[PATH_MAX] = {0};
char tmp_path[PATH_MAX] = {0}; char user_path[PATH_MAX] = {0};
char tmp_path[PATH_MAX] = {0};
char workdir[PATH_MAX] = {0}; char workdir[PATH_MAX] = {0};
getcwd(workdir, sizeof(workdir)); getcwd(workdir, sizeof(workdir));
if(!string_is_empty(workdir)) if(!string_is_empty(workdir))
{ {
snprintf(assets_path, sizeof(data_path), snprintf(assets_path, sizeof(data_path),
"%s/app/native/assets", workdir); "%s/app/native/assets", workdir);
snprintf(data_path, sizeof(data_path), snprintf(data_path, sizeof(data_path),
"%s/data", workdir); "%s/data", workdir);
snprintf(user_path, sizeof(user_path), snprintf(user_path, sizeof(user_path),
"%s/shared/misc/retroarch", workdir); "%s/shared/misc/retroarch", workdir);
snprintf(tmp_path, sizeof(user_path), snprintf(tmp_path, sizeof(user_path),
"%s/tmp", workdir); "%s/tmp", workdir);
} }
else else
{ {
snprintf(assets_path, sizeof(data_path), "app/native/assets"); snprintf(assets_path, sizeof(data_path), "app/native/assets");
snprintf(data_path, sizeof(data_path), "data"); snprintf(data_path, sizeof(data_path), "data");
snprintf(user_path, sizeof(user_path), "shared/misc/retroarch"); snprintf(user_path, sizeof(user_path), "shared/misc/retroarch");
snprintf(tmp_path, sizeof(user_path), "tmp"); snprintf(tmp_path, sizeof(user_path), "tmp");
} }
// app data /* app data */
fill_pathname_join(g_defaults.dir.core, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], data_path,
"cores", sizeof(g_defaults.dir.core)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.assets, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], data_path,
"assets", sizeof(g_defaults.dir.assets)); "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.autoconfig, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], data_path,
"autoconfig", sizeof(g_defaults.dir.autoconfig)); "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_join(g_defaults.dir.cursor, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], data_path,
"database/cursors", sizeof(g_defaults.dir.cursor)); "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.database, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], data_path,
"database/rdb", sizeof(g_defaults.dir.database)); "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.core_info, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], data_path,
"info", sizeof(g_defaults.dir.core_info)); "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.overlay, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], data_path,
"overlays", sizeof(g_defaults.dir.overlay)); "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_join(g_defaults.dir.shader, data_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADERS], data_path,
"shaders", sizeof(g_defaults.dir.shader)); "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADERS]));
// user data /* user data */
fill_pathname_join(g_defaults.dir.cheats, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path,
"cheats", sizeof(g_defaults.dir.cheats)); "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dir.menu_config, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], user_path,
"config", sizeof(g_defaults.dir.menu_config)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.menu_content, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT], user_path,
"content", sizeof(g_defaults.dir.menu_content)); "content", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONTENT]));
fill_pathname_join(g_defaults.dir.core_assets, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], user_path,
"downloads", sizeof(g_defaults.dir.core_assets)); "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.audio_filter, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], user_path,
"filters/audio", sizeof(g_defaults.dir.audio_filter)); "filters/audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
fill_pathname_join(g_defaults.dir.video_filter, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_VIDEO_FILTER], user_path,
"filters/video", sizeof(g_defaults.dir.video_filter)); "filters/video", sizeof(g_defaults.dirs[DEFAULT_VIDEO_FILTER]));
fill_pathname_join(g_defaults.dir.playlist, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], user_path,
"playlists", sizeof(g_defaults.dir.playlist)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.remap, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], user_path,
"remaps", sizeof(g_defaults.dir.remap)); "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.sram, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], user_path,
"saves", sizeof(g_defaults.dir.sram)); "saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.screenshot, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], user_path,
"screenshots", sizeof(g_defaults.dir.screenshot)); "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dir.savestate, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], user_path,
"states", sizeof(g_defaults.dir.savestate)); "states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], user_path,
"system", sizeof(g_defaults.dir.system)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.thumbnails, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAIL], user_path,
"thumbnails", sizeof(g_defaults.dir.thumbnails)); "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAIL]));
fill_pathname_join(g_defaults.dir.wallpapers, user_path, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS], user_path,
"wallpapers", sizeof(g_defaults.dir.wallpapers)); "wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]));
// tmp /* tmp */
strlcpy(g_defaults.dir.cache, tmp_path, sizeof(g_defaults.dir.cache)); strlcpy(g_defaults.dirs[DEFAULT_DIR_CACHE],
tmp_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
// history and main config /* history and main config */
strlcpy(g_defaults.dir.content_history, strlcpy(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY],
user_path, sizeof(g_defaults.dir.content_history)); user_path, sizeof(g_defaults.dirs[DEFAULT_DIR_CONTENT_HISTORY]));
fill_pathname_join(g_defaults.path.config, user_path, fill_pathname_join(g_defaults.path.config, user_path,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
// bundle copy /* bundle copy */
char data_assets_path[PATH_MAX] = {0}; char data_assets_path[PATH_MAX] = {0};
sprintf(data_assets_path, "%s/%s", data_path, "assets"); sprintf(data_assets_path, "%s/%s", data_path, "assets");
if(!path_file_exists(data_assets_path)) if(!path_file_exists(data_assets_path))
{ {
RARCH_LOG( "Copying application assets to data directory...\n" ); RARCH_LOG( "Copying application assets to data directory...\n" );
char copy_command[PATH_MAX] = {0}; char copy_command[PATH_MAX] = {0};
sprintf(copy_command, "cp -r %s/. %s", assets_path, data_path); sprintf(copy_command, "cp -r %s/. %s", assets_path, data_path);
if(system(copy_command) == -1) { if(system(copy_command) == -1) {
RARCH_LOG( "Asset copy failed: Shell could not be run.\n" ); RARCH_LOG( "Asset copy failed: Shell could not be run.\n" );
} else { } else {
RARCH_LOG( "Asset copy successful.\n"); RARCH_LOG( "Asset copy successful.\n");
} }
} }
// create user data dirs for (i = 0; i < DEFAULT_DIR_LAST; i++)
path_mkdir(g_defaults.dir.cheats); {
path_mkdir(g_defaults.dir.menu_config); const char *dir_path = g_defaults.dirs[i];
path_mkdir(g_defaults.dir.menu_content); if (!string_is_empty(dir_path))
path_mkdir(g_defaults.dir.core_assets); check_defaults_dir_create_dir(dir_path);
path_mkdir(g_defaults.dir.playlist); }
path_mkdir(g_defaults.dir.remap);
path_mkdir(g_defaults.dir.savestate);
path_mkdir(g_defaults.dir.screenshot);
path_mkdir(g_defaults.dir.sram);
path_mkdir(g_defaults.dir.system);
path_mkdir(g_defaults.dir.thumbnails);
// set glui as default menu /* set glui as default menu */
snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "glui"); snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "glui");
} }

View File

@ -80,40 +80,46 @@ static const char *elf_path_cst = WIIU_SD_PATH "retroarch/retroarch.elf";
static void frontend_wiiu_get_environment_settings(int *argc, char *argv[], static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data) void *args, void *params_data)
{ {
unsigned i;
(void)args; (void)args;
fill_pathname_basedir(g_defaults.dir.port, elf_path_cst, sizeof(g_defaults.dir.port)); 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.dir.port); fill_pathname_join(g_defaults.dir[DEFAULT_DIR_CORE_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
"downloads", sizeof(g_defaults.dir[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dir.core_assets, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
"downloads", sizeof(g_defaults.dir.core_assets)); "media", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dir.assets, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
"media", sizeof(g_defaults.dir.assets)); "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dir.core, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], g_defaults.dirs[DEFAULT_DIR_CORE],
"cores", sizeof(g_defaults.dir.core)); "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE], g_defaults.dirs[DEFAULT_DIR_CORE],
"info", sizeof(g_defaults.dir.core_info)); "savestates", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM], g_defaults.dirs[DEFAULT_DIR_CORE],
"savestates", sizeof(g_defaults.dir.savestate)); "savefiles", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], g_defaults.dirs[DEFAULT_DIR_CORE],
"savefiles", sizeof(g_defaults.dir.sram)); "system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST], g_defaults.dirs[DEFAULT_DIR_CORE],
"system", sizeof(g_defaults.dir.system)); "playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], g_defaults.dirs[DEFAULT_DIR_PORT],
"playlists", sizeof(g_defaults.dir.playlist)); "config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dir.menu_config, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_PORT],
"config", sizeof(g_defaults.dir.menu_config)); "config/remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], g_defaults.dirs[DEFAULT_DIR_PORT],
"config/remaps", sizeof(g_defaults.dir.remap)); "filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
fill_pathname_join(g_defaults.dir.video_filter, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], g_defaults.dirs[DEFAULT_DIR_PORT],
"filters", sizeof(g_defaults.dir.remap)); "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_join(g_defaults.dir.database, g_defaults.dir.port, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], g_defaults.dirs[DEFAULT_DIR_PORT],
"database/rdb", sizeof(g_defaults.dir.database)); "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_join(g_defaults.dir.cursor, g_defaults.dir.port, fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
"database/cursors", sizeof(g_defaults.dir.cursor));
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(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))
check_defaults_dir_create_dir(dir_path);
}
} }
static void frontend_wiiu_deinit(void *data) static void frontend_wiiu_deinit(void *data)

View File

@ -179,9 +179,12 @@ static void frontend_win32_init(void *data)
{ {
typedef BOOL (WINAPI *isProcessDPIAwareProc)(); typedef BOOL (WINAPI *isProcessDPIAwareProc)();
typedef BOOL (WINAPI *setProcessDPIAwareProc)(); typedef BOOL (WINAPI *setProcessDPIAwareProc)();
HMODULE handle = GetModuleHandle("User32.dll"); HMODULE handle =
isProcessDPIAwareProc isDPIAwareProc = (isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware"); GetModuleHandle("User32.dll");
setProcessDPIAwareProc setDPIAwareProc = (setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware"); isProcessDPIAwareProc isDPIAwareProc =
(isProcessDPIAwareProc)dylib_proc(handle, "IsProcessDPIAware");
setProcessDPIAwareProc setDPIAwareProc =
(setProcessDPIAwareProc)dylib_proc(handle, "SetProcessDPIAware");
if (isDPIAwareProc) if (isDPIAwareProc)
{ {
@ -257,63 +260,55 @@ static void frontend_win32_environment_get(int *argc, char *argv[],
{ {
gfx_set_dwm(); gfx_set_dwm();
fill_pathname_expand_special(g_defaults.dir.assets, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_ASSETS],
":\\assets", sizeof(g_defaults.dir.assets)); ":\\assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_expand_special(g_defaults.dir.audio_filter, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_AUDIO_FILTER],
":\\filters\\audio", sizeof(g_defaults.dir.audio_filter)); ":\\filters\\audio", sizeof(g_defaults.dirs[DEFAULT_AUDIO_FILTER]));
fill_pathname_expand_special(g_defaults.dir.video_filter, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
":\\filters\\video", sizeof(g_defaults.dir.video_filter)); ":\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
fill_pathname_expand_special(g_defaults.dir.cheats, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS],
":\\cheats", sizeof(g_defaults.dir.cheats)); ":\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_expand_special(g_defaults.dir.database, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_DATABASE],
":\\database\\rdb", sizeof(g_defaults.dir.database)); ":\\database\\rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
fill_pathname_expand_special(g_defaults.dir.cursor, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CURSOR],
":\\database\\cursors", sizeof(g_defaults.dir.cursor)); ":\\database\\cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR]));
fill_pathname_expand_special(g_defaults.dir.playlist, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
":\\playlists", sizeof(g_defaults.dir.assets)); ":\\playlists", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_expand_special(g_defaults.dir.menu_config, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
":\\config", sizeof(g_defaults.dir.menu_config)); ":\\config", sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_expand_special(g_defaults.dir.remap, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_REMAP],
":\\config\\remaps", sizeof(g_defaults.dir.remap)); ":\\config\\remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_expand_special(g_defaults.dir.wallpapers, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS],
":\\assets\\wallpapers", sizeof(g_defaults.dir.wallpapers)); ":\\assets\\wallpapers", sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]));
fill_pathname_expand_special(g_defaults.dir.thumbnails, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_THUMBNAIL],
":\\thumbnails", sizeof(g_defaults.dir.thumbnails)); ":\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAIL]));
fill_pathname_expand_special(g_defaults.dir.overlay, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY],
":\\overlays", sizeof(g_defaults.dir.overlay)); ":\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
fill_pathname_expand_special(g_defaults.dir.core, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE],
":\\cores", sizeof(g_defaults.dir.core)); ":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_expand_special(g_defaults.dir.core_info, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
":\\info", sizeof(g_defaults.dir.core_info)); ":\\info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_expand_special(g_defaults.dir.autoconfig, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
":\\autoconfig", sizeof(g_defaults.dir.autoconfig)); ":\\autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
fill_pathname_expand_special(g_defaults.dir.shader, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SHADER],
":\\shaders", sizeof(g_defaults.dir.shader)); ":\\shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_expand_special(g_defaults.dir.core_assets, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE]_assets,
":\\downloads", sizeof(g_defaults.dir.core_assets)); ":\\downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]_assets));
fill_pathname_expand_special(g_defaults.dir.screenshot, fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
":\\screenshots", sizeof(g_defaults.dir.screenshot)); ":\\screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
/* don't force this in the driver anymore, these will be handled by
a dummy config file so they can be reset to content dir
fill_pathname_expand_special(g_defaults.dir.sram,
":\\saves", sizeof(g_defaults.dir.sram));
fill_pathname_expand_special(g_defaults.dir.savestate,
":\\states", sizeof(g_defaults.dir.savestate));
fill_pathname_expand_special(g_defaults.dir.system,
":\\system", sizeof(g_defaults.dir.system));
*/
#ifdef HAVE_MENU #ifdef HAVE_MENU
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "xmb"); snprintf(g_defaults.settings.menu,
sizeof(g_defaults.settings.menu), "xmb");
#endif #endif
#endif #endif
} }
static uint64_t frontend_win32_get_mem_total(void) static uint64_t frontend_win32_get_mem_total(void)
{ {
/* OSes below 2000 don't have the Ex version, and non-Ex cannot work with >4GB RAM */ /* OSes below 2000 don't have the Ex version,
* and non-Ex cannot work with >4GB RAM */
#if _WIN32_WINNT > 0x0400 #if _WIN32_WINNT > 0x0400
MEMORYSTATUSEX mem_info; MEMORYSTATUSEX mem_info;
mem_info.dwLength = sizeof(MEMORYSTATUSEX); mem_info.dwLength = sizeof(MEMORYSTATUSEX);
@ -329,7 +324,8 @@ static uint64_t frontend_win32_get_mem_total(void)
static uint64_t frontend_win32_get_mem_used(void) static uint64_t frontend_win32_get_mem_used(void)
{ {
/* OSes below 2000 don't have the Ex version, and non-Ex cannot work with >4GB RAM */ /* OSes below 2000 don't have the Ex version,
* and non-Ex cannot work with >4GB RAM */
#if _WIN32_WINNT > 0x0400 #if _WIN32_WINNT > 0x0400
MEMORYSTATUSEX mem_info; MEMORYSTATUSEX mem_info;
mem_info.dwLength = sizeof(MEMORYSTATUSEX); mem_info.dwLength = sizeof(MEMORYSTATUSEX);
@ -349,25 +345,30 @@ static void frontend_win32_attach_console(void)
#ifdef _WIN32_WINNT_WINXP #ifdef _WIN32_WINNT_WINXP
/* msys will start the process with FILE_TYPE_PIPE connected. /* msys will start the process with FILE_TYPE_PIPE connected.
* cmd will start the process with FILE_TYPE_UNKNOWN connected (since this is subsystem windows application * cmd will start the process with FILE_TYPE_UNKNOWN connected
* ... UNLESS stdout/stderr were redirected (then FILE_TYPE_DISK will be connected most likely) * (since this is subsystem windows application
* ... UNLESS stdout/stderr were redirected (then FILE_TYPE_DISK
* will be connected most likely)
* explorer will start the process with NOTHING connected. * explorer will start the process with NOTHING connected.
* *
* Now, let's not reconnect anything that's already connected. * Now, let's not reconnect anything that's already connected.
* If any are disconnected, open a console, and connect to them. * If any are disconnected, open a console, and connect to them.
* In case we're launched from msys or cmd, try attaching to the parent process console first. * In case we're launched from msys or cmd, try attaching to the
* Take care to leave a record of what we did, so we can undo it precisely * parent process console first.
*
* Take care to leave a record of what we did, so we can
* undo it precisely.
*/ */
bool need_stdout = (GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) == FILE_TYPE_UNKNOWN); bool need_stdout = (GetFileType(GetStdHandle(STD_OUTPUT_HANDLE))
bool need_stderr = (GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN); == FILE_TYPE_UNKNOWN);
bool need_stderr = (GetFileType(GetStdHandle(STD_ERROR_HANDLE))
== FILE_TYPE_UNKNOWN);
if(need_stdout || need_stderr) if(need_stdout || need_stderr)
{ {
if(!AttachConsole( ATTACH_PARENT_PROCESS)) if(!AttachConsole( ATTACH_PARENT_PROCESS))
{
AllocConsole(); AllocConsole();
}
if(need_stdout) freopen( "CONOUT$", "w", stdout ); if(need_stdout) freopen( "CONOUT$", "w", stdout );
if(need_stderr) freopen( "CONOUT$", "w", stderr ); if(need_stderr) freopen( "CONOUT$", "w", stderr );
@ -386,8 +387,9 @@ static void frontend_win32_detach_console(void)
if(console_needs_free) if(console_needs_free)
{ {
/* we don't reconnect stdout/stderr to anything here, because by definition, they weren't connected to anything in the first place. */ /* we don't reconnect stdout/stderr to anything here,
* because by definition, they weren't connected to
* anything in the first place. */
FreeConsole(); FreeConsole();
console_needs_free = false; console_needs_free = false;
} }

View File

@ -1135,34 +1135,50 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
#endif #endif
#if defined(_XBOX1) #if defined(_XBOX1)
strlcpy(g_defaults.dir.core, "D:", sizeof(g_defaults.dir.core)); strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.path.config, g_defaults.dir.core, "D:", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_CORE],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.dir.savestate, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
"savestates", sizeof(g_defaults.dir.savestate)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.sram, g_defaults.dir.core, "savestates",
"savefiles", sizeof(g_defaults.dir.sram)); sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dir.system, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
"system", sizeof(g_defaults.dir.system)); g_defaults.dirs[DEFAULT_DIR_CORE],
fill_pathname_join(g_defaults.dir.screenshot, g_defaults.dir.core, "savefiles",
"screenshots", sizeof(g_defaults.dir.screenshot)); sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
g_defaults.dirs[DEFAULT_DIR_CORE],
"system",
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
g_defaults.dirs[DEFAULT_DIR_CORE],
"screenshots",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
#elif defined(_XBOX360) #elif defined(_XBOX360)
strlcpy(g_defaults.dir.core, "game:", sizeof(g_defaults.dir.core)); strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE],
"game:",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
strlcpy(g_defaults.path.config, strlcpy(g_defaults.path.config,
"game:\\retroarch.cfg", sizeof(g_defaults.path.config)); "game:\\retroarch.cfg", sizeof(g_defaults.path.config));
strlcpy(g_defaults.dir.screenshot, strlcpy(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
"game:", sizeof(g_defaults.dir.screenshot)); "game:",
strlcpy(g_defaults.dir.savestate, sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
"game:\\savestates", sizeof(g_defaults.dir.savestate)); strlcpy(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
strlcpy(g_defaults.dir.playlist, "game:\\savestates",
"game:\\playlists", sizeof(g_defaults.dir.playlist)); sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
strlcpy(g_defaults.dir.sram, strlcpy(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
"game:\\savefiles", sizeof(g_defaults.dir.sram)); "game:\\playlists",
strlcpy(g_defaults.dir.system, sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
"game:\\system", sizeof(g_defaults.dir.system)); strlcpy(g_defaults.dirs[DEFAULT_DIR_SRAM],
"game:\\savefiles",
sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
strlcpy(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
"game:\\system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
#endif #endif
fill_pathname_join(g_defaults.dir.core_info, g_defaults.dir.core, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
"info", sizeof(g_defaults.dir.core_info)); g_defaults.dirs[DEFAULT_DIR_CORE],
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
#ifndef IS_SALAMANDER #ifndef IS_SALAMANDER
static char path[PATH_MAX_LENGTH] = {0}; static char path[PATH_MAX_LENGTH] = {0};

View File

@ -103,7 +103,7 @@ static void find_and_set_first_file(char *s, size_t len,
char first_file[PATH_MAX_LENGTH] = {0}; char first_file[PATH_MAX_LENGTH] = {0};
find_first_libretro_core(first_file, sizeof(first_file), find_first_libretro_core(first_file, sizeof(first_file),
g_defaults.dir.core, ext); g_defaults.dirs[DEFAULT_DIR_CORE], ext);
if (string_is_empty(first_file)) if (string_is_empty(first_file))
{ {
@ -111,7 +111,7 @@ static void find_and_set_first_file(char *s, size_t len,
return; return;
} }
fill_pathname_join(s, g_defaults.dir.core, first_file, len); fill_pathname_join(s, g_defaults.dirs[DEFAULT_DIR_CORE], first_file, len);
RARCH_LOG("libretro_path now set to: %s.\n", s); RARCH_LOG("libretro_path now set to: %s.\n", s);
} }

View File

@ -6422,7 +6422,7 @@ static bool setting_append_list(
sizeof(settings->paths.directory_libretro), sizeof(settings->paths.directory_libretro),
MENU_ENUM_LABEL_LIBRETRO_DIR_PATH, MENU_ENUM_LABEL_LIBRETRO_DIR_PATH,
MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH, MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH,
g_defaults.dir.core, g_defaults.dirs[DEFAULT_DIR_CORE],
MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE,
&group_info, &group_info,
&subgroup_info, &subgroup_info,
@ -6437,7 +6437,7 @@ static bool setting_append_list(
sizeof(settings->paths.path_libretro_info), sizeof(settings->paths.path_libretro_info),
MENU_ENUM_LABEL_LIBRETRO_INFO_PATH, MENU_ENUM_LABEL_LIBRETRO_INFO_PATH,
MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH, MENU_ENUM_LABEL_VALUE_LIBRETRO_INFO_PATH,
g_defaults.dir.core_info, g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE, MENU_ENUM_LABEL_VALUE_DIRECTORY_NONE,
&group_info, &group_info,
&subgroup_info, &subgroup_info,
@ -6524,7 +6524,7 @@ static bool setting_append_list(
sizeof(settings->paths.directory_video_shader), sizeof(settings->paths.directory_video_shader),
MENU_ENUM_LABEL_VIDEO_SHADER_DIR, MENU_ENUM_LABEL_VIDEO_SHADER_DIR,
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_DIR,
g_defaults.dir.shader, g_defaults.dirs[DEFAULT_DIR_SHADER],
MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT,
&group_info, &group_info,
&subgroup_info, &subgroup_info,
@ -6569,7 +6569,7 @@ static bool setting_append_list(
sizeof(settings->paths.directory_overlay), sizeof(settings->paths.directory_overlay),
MENU_ENUM_LABEL_OVERLAY_DIRECTORY, MENU_ENUM_LABEL_OVERLAY_DIRECTORY,
MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY, MENU_ENUM_LABEL_VALUE_OVERLAY_DIRECTORY,
g_defaults.dir.overlay, g_defaults.dirs[DEFAULT_DIR_OVERLAY],
MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT,
&group_info, &group_info,
&subgroup_info, &subgroup_info,