* Create fill_pathname_join_special - and specify fill_pathname_join

as deprecated.
* Use fill_pathname_join_special in the vast majority of cases where
we can ensure out_path is a new empty string
* Get rid of some extension concatenation with strlcat where encountered
* Some general cleanups with NULL termination of strings that get immediately
passed to strlcpy/strlcpy-adjacent functions
This commit is contained in:
LibretroAdmin 2022-08-04 14:18:11 +02:00
parent 3aa1811ca9
commit b2634ea588
61 changed files with 424 additions and 366 deletions

View File

@ -1356,7 +1356,7 @@ void audio_driver_load_system_sounds(void)
sounds_path[0] = basename_noext[0] ='\0';
fill_pathname_join(
fill_pathname_join_special(
sounds_fallback_path,
dir_assets,
"sounds",

View File

@ -164,8 +164,6 @@ bool cheat_manager_save(
(char*)"cheat%u_repeat_add_to_address"
};
cheats_file[0] = '\0';
if (!cheat_st->cheats || cheat_st->size == 0)
return false;
@ -173,9 +171,13 @@ bool cheat_manager_save(
strlcpy(cheats_file, path, sizeof(cheats_file));
else
{
fill_pathname_join(cheats_file,
size_t len = fill_pathname_join_special(cheats_file,
cheat_database, path, sizeof(cheats_file));
strlcat(cheats_file, ".cht", sizeof(cheats_file));
cheats_file[len ] = '.';
cheats_file[len+1] = 'c';
cheats_file[len+2] = 'h';
cheats_file[len+3] = 't';
cheats_file[len+4] = '\0';
}
if (!overwrite)
@ -710,8 +712,6 @@ static bool cheat_manager_get_game_specific_filename(
const char *core_name = NULL;
const char *game_name = NULL;
s1[0] = '\0';
if (!core_get_system_info(&system_info))
return false;
@ -723,9 +723,7 @@ static bool cheat_manager_get_game_specific_filename(
string_is_empty(game_name))
return false;
s[0] = '\0';
fill_pathname_join(s1,
fill_pathname_join_special(s1,
path_cheat_database, core_name,
sizeof(s1));
@ -736,7 +734,7 @@ static bool cheat_manager_get_game_specific_filename(
path_mkdir(s1);
}
fill_pathname_join(s, s1, game_name, len);
fill_pathname_join_special(s, s1, game_name, len);
return true;
}

View File

@ -1445,9 +1445,10 @@ static void rcheevos_async_write_badge(retro_task_t* task)
rcheevos_fetch_badge_data* badge_data =
(rcheevos_fetch_badge_data*)task->user_data;
fill_pathname_join(badge_fullpath, badge_data->state->badge_directory,
badge_data->state->requested_badges[badge_data->request_index],
sizeof(badge_fullpath));
fill_pathname_join_special(badge_fullpath,
badge_data->state->badge_directory,
badge_data->state->requested_badges[badge_data->request_index],
sizeof(badge_fullpath));
if (!filestream_write_file(badge_fullpath, badge_data->data, badge_data->data_len))
{

View File

@ -1437,7 +1437,7 @@ bool command_set_shader(command_t *cmd, const char *arg)
{
char abs_arg[PATH_MAX_LENGTH];
const char *ref_path = settings->paths.directory_video_shader;
fill_pathname_join(abs_arg, ref_path, arg, sizeof(abs_arg));
fill_pathname_join_special(abs_arg, ref_path, arg, sizeof(abs_arg));
return apply_shader(settings, type, abs_arg, true);
}
}
@ -1476,8 +1476,6 @@ bool command_event_save_core_config(
}
core_path = path_get(RARCH_PATH_CORE);
config_name[0] = '\0';
config_path[0] = '\0';
/* Infer file name based on libretro core. */
if (path_is_valid(core_path))
@ -1488,7 +1486,7 @@ bool command_event_save_core_config(
fill_pathname_base(config_name, core_path, sizeof(config_name));
path_remove_extension(config_name);
fill_pathname_join(config_path, config_dir, config_name,
fill_pathname_join_special(config_path, config_dir, config_name,
sizeof(config_path));
/* In case of collision, find an alternative name. */
@ -1513,7 +1511,7 @@ bool command_event_save_core_config(
RARCH_WARN("[Config]: %s\n",
msg_hash_to_str(MSG_CANNOT_INFER_NEW_CONFIG_PATH));
fill_dated_filename(config_name, ".cfg", sizeof(config_name));
fill_pathname_join(config_path, config_dir, config_name,
fill_pathname_join_special(config_path, config_dir, config_name,
sizeof(config_path));
}

View File

@ -2863,12 +2863,10 @@ void config_set_defaults(void *data)
sizeof(settings->paths.directory_overlay));
#ifdef RARCH_MOBILE
if (string_is_empty(settings->paths.path_overlay))
{
fill_pathname_join(settings->paths.path_overlay,
fill_pathname_join_special(settings->paths.path_overlay,
settings->paths.directory_overlay,
FILE_PATH_DEFAULT_OVERLAY,
sizeof(settings->paths.path_overlay));
}
#endif
}
#endif
@ -2890,7 +2888,7 @@ void config_set_defaults(void *data)
#if TARGET_OS_IPHONE
{
char config_file_path[PATH_MAX_LENGTH];
fill_pathname_join(config_file_path,
fill_pathname_join_special(config_file_path,
settings->paths.directory_menu_config,
FILE_PATH_MAIN_CONFIG,
sizeof(config_file_path));
@ -3052,7 +3050,7 @@ static config_file_t *open_default_config_file(void)
application_data[0] = '\0';
#endif
conf_path[0] = app_path[0] = '\0';
app_path[0] = '\0';
#if defined(_WIN32) && !defined(_XBOX)
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
@ -3071,7 +3069,7 @@ static config_file_t *open_default_config_file(void)
if (fill_pathname_application_data(application_data,
sizeof(application_data)))
{
fill_pathname_join(conf_path, application_data,
fill_pathname_join_special(conf_path, application_data,
FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
conf = config_file_new_from_path_to_string(conf_path);
}
@ -3114,7 +3112,7 @@ static config_file_t *open_default_config_file(void)
path_mkdir(application_data);
fill_pathname_join(conf_path, application_data,
fill_pathname_join_special(conf_path, application_data,
FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
conf = config_file_new_from_path_to_string(conf_path);
@ -3146,7 +3144,7 @@ static config_file_t *open_default_config_file(void)
if (has_application_data)
{
fill_pathname_join(conf_path, application_data,
fill_pathname_join_special(conf_path, application_data,
FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
RARCH_LOG("[Config]: Looking for config in: \"%s\".\n", conf_path);
conf = config_file_new_from_path_to_string(conf_path);
@ -3155,7 +3153,7 @@ static config_file_t *open_default_config_file(void)
/* Fallback to $HOME/.retroarch.cfg. */
if (!conf && getenv("HOME"))
{
fill_pathname_join(conf_path, getenv("HOME"),
fill_pathname_join_special(conf_path, getenv("HOME"),
"." FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
RARCH_LOG("[Config]: Looking for config in: \"%s\".\n", conf_path);
conf = config_file_new_from_path_to_string(conf_path);
@ -3167,7 +3165,7 @@ static config_file_t *open_default_config_file(void)
char basedir[PATH_MAX_LENGTH];
/* Try to create a new config file. */
fill_pathname_basedir(basedir, application_data, sizeof(basedir));
fill_pathname_join(conf_path, application_data,
fill_pathname_join_special(conf_path, application_data,
FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
dir_created = path_mkdir(basedir);
@ -3178,7 +3176,7 @@ static config_file_t *open_default_config_file(void)
bool saved = false;
/* Build a retroarch.cfg path from the
* global config directory (/etc). */
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
fill_pathname_join_special(skeleton_conf, GLOBAL_CONFIG_DIR,
FILE_PATH_MAIN_CONFIG, sizeof(skeleton_conf));
if ((conf = config_file_new_from_path_to_string(skeleton_conf)))
RARCH_WARN("[Config]: Using skeleton config \"%s\" as base for a new config file.\n", skeleton_conf);
@ -3532,7 +3530,7 @@ static bool config_load_file(global_t *global,
FILE_PATH_CONTENT_FAVORITES,
sizeof(settings->paths.path_content_favorites));
else
fill_pathname_join(
fill_pathname_join_special(
settings->paths.path_content_favorites,
settings->paths.directory_content_favorites,
FILE_PATH_CONTENT_FAVORITES,
@ -3548,7 +3546,7 @@ static bool config_load_file(global_t *global,
FILE_PATH_CONTENT_HISTORY,
sizeof(settings->paths.path_content_history));
else
fill_pathname_join(
fill_pathname_join_special(
settings->paths.path_content_history,
settings->paths.directory_content_history,
FILE_PATH_CONTENT_HISTORY,
@ -3564,7 +3562,7 @@ static bool config_load_file(global_t *global,
FILE_PATH_CONTENT_IMAGE_HISTORY,
sizeof(settings->paths.path_content_image_history));
else
fill_pathname_join(
fill_pathname_join_special(
settings->paths.path_content_image_history,
settings->paths.directory_content_image_history,
FILE_PATH_CONTENT_IMAGE_HISTORY,
@ -3580,7 +3578,7 @@ static bool config_load_file(global_t *global,
FILE_PATH_CONTENT_MUSIC_HISTORY,
sizeof(settings->paths.path_content_music_history));
else
fill_pathname_join(
fill_pathname_join_special(
settings->paths.path_content_music_history,
settings->paths.directory_content_music_history,
FILE_PATH_CONTENT_MUSIC_HISTORY,
@ -3596,7 +3594,7 @@ static bool config_load_file(global_t *global,
FILE_PATH_CONTENT_VIDEO_HISTORY,
sizeof(settings->paths.path_content_video_history));
else
fill_pathname_join(
fill_pathname_join_special(
settings->paths.path_content_video_history,
settings->paths.directory_content_video_history,
FILE_PATH_CONTENT_VIDEO_HISTORY,
@ -4430,6 +4428,7 @@ bool config_save_autoconf_profile(const
"~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"",
NULL
};
size_t len;
unsigned i;
char buf[PATH_MAX_LENGTH];
char autoconf_file[PATH_MAX_LENGTH];
@ -4479,15 +4478,19 @@ bool config_save_autoconf_profile(const
}
/* Generate autoconfig file path */
fill_pathname_join(buf, autoconf_dir, joypad_driver, sizeof(buf));
fill_pathname_join_special(buf, autoconf_dir, joypad_driver, sizeof(buf));
if (path_is_directory(buf))
fill_pathname_join(autoconf_file, buf,
len = fill_pathname_join_special(autoconf_file, buf,
sanitised_name, sizeof(autoconf_file));
else
fill_pathname_join(autoconf_file, autoconf_dir,
len = fill_pathname_join_special(autoconf_file, autoconf_dir,
sanitised_name, sizeof(autoconf_file));
strlcat(autoconf_file, ".cfg", sizeof(autoconf_file));
autoconf_file[len ] = '.';
autoconf_file[len+1] = 'c';
autoconf_file[len+2] = 'f';
autoconf_file[len+3] = 'g';
autoconf_file[len+4] = '\0';
/* Open config file */
if ( !(conf = config_file_new_from_path_to_string(autoconf_file))
@ -4807,7 +4810,6 @@ bool config_save_overrides(enum override_type type, void *data)
const char *game_name = NULL;
bool has_content = !string_is_empty(rarch_path_basename);
config_directory[0] = '\0';
core_path[0] = '\0';
game_path[0] = '\0';
content_path[0] = '\0';
@ -4828,7 +4830,7 @@ bool config_save_overrides(enum override_type type, void *data)
sizeof(config_directory),
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
fill_pathname_join(override_directory,
fill_pathname_join_special(override_directory,
config_directory, core_name,
sizeof(override_directory));

View File

@ -84,11 +84,13 @@ static bool core_backup_get_backup_dir(
/* Get core backup directory
* > If no assets directory is defined, use
* core directory as a base */
fill_pathname_join(tmp, string_is_empty(dir_core_assets) ?
dir_libretro : dir_core_assets,
fill_pathname_join_special(tmp,
string_is_empty(dir_core_assets)
? dir_libretro
: dir_core_assets,
"core_backups", sizeof(tmp));
fill_pathname_join(backup_dir, tmp,
fill_pathname_join_special(backup_dir, tmp,
core_file_id, len);
if (string_is_empty(backup_dir))
@ -163,7 +165,7 @@ bool core_backup_get_backup_path(
FILE_PATH_CORE_BACKUP_EXTENSION);
/* Build final path */
fill_pathname_join(backup_path, backup_dir,
fill_pathname_join_special(backup_path, backup_dir,
backup_filename, len);
return true;
@ -379,7 +381,7 @@ enum core_backup_type core_backup_get_core_path(
break;
/* All good - build core path */
fill_pathname_join(core_path, dir_libretro,
fill_pathname_join_special(core_path, dir_libretro,
core_filename, len);
backup_type = CORE_BACKUP_TYPE_ARCHIVE;
@ -387,7 +389,7 @@ enum core_backup_type core_backup_get_core_path(
break;
case CORE_BACKUP_TYPE_LIB:
/* This is a plain dynamic library file */
fill_pathname_join(core_path, dir_libretro,
fill_pathname_join_special(core_path, dir_libretro,
backup_filename, len);
backup_type = CORE_BACKUP_TYPE_LIB;
break;

View File

@ -709,7 +709,7 @@ static core_info_cache_list_t *core_info_cache_read(const char *info_dir)
strlcpy(file_path,
FILE_PATH_CORE_INFO_CACHE_REFRESH, sizeof(file_path));
else
fill_pathname_join(file_path,
fill_pathname_join_special(file_path,
info_dir, FILE_PATH_CORE_INFO_CACHE_REFRESH,
sizeof(file_path));
@ -720,7 +720,8 @@ static core_info_cache_list_t *core_info_cache_read(const char *info_dir)
if (string_is_empty(info_dir))
strlcpy(file_path, FILE_PATH_CORE_INFO_CACHE, sizeof(file_path));
else
fill_pathname_join(file_path, info_dir, FILE_PATH_CORE_INFO_CACHE,
fill_pathname_join_special(file_path, info_dir,
FILE_PATH_CORE_INFO_CACHE,
sizeof(file_path));
#if defined(HAVE_ZLIB)
@ -828,7 +829,8 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
if (string_is_empty(info_dir))
strlcpy(file_path, FILE_PATH_CORE_INFO_CACHE, sizeof(file_path));
else
fill_pathname_join(file_path, info_dir, FILE_PATH_CORE_INFO_CACHE,
fill_pathname_join_special(file_path, info_dir,
FILE_PATH_CORE_INFO_CACHE,
sizeof(file_path));
#if defined(CORE_INFO_CACHE_COMPRESS)
@ -1180,7 +1182,7 @@ static bool core_info_cache_write(core_info_cache_list_t *list, const char *info
strlcpy(file_path,
FILE_PATH_CORE_INFO_CACHE_REFRESH, sizeof(file_path));
else
fill_pathname_join(file_path,
fill_pathname_join_special(file_path,
info_dir, FILE_PATH_CORE_INFO_CACHE_REFRESH,
sizeof(file_path));
@ -1230,7 +1232,7 @@ bool core_info_cache_force_refresh(const char *path_info)
strlcpy(file_path,
FILE_PATH_CORE_INFO_CACHE_REFRESH, sizeof(file_path));
else
fill_pathname_join(file_path,
fill_pathname_join_special(file_path,
path_info, FILE_PATH_CORE_INFO_CACHE_REFRESH,
sizeof(file_path));
@ -1656,7 +1658,8 @@ static config_file_t *core_info_get_config_file(
"%s" ".info", core_file_id);
else
{
size_t len = fill_pathname_join(info_path, info_dir, core_file_id,
size_t len = fill_pathname_join_special(info_path, info_dir,
core_file_id,
sizeof(info_path));
info_path[len] = '.';
info_path[len+1] = 'i';

View File

@ -430,14 +430,14 @@ static bool core_updater_list_set_paths(
* > Leave blank if this is not a buildbot core */
if (list_type == CORE_UPDATER_LIST_TYPE_BUILDBOT)
{
fill_pathname_join(
fill_pathname_join_special(
remote_core_path,
network_buildbot_url,
filename_str,
sizeof(remote_core_path));
/* > Apply proper URL encoding (messy...) */
tmp_url = strdup(remote_core_path);
tmp_url = strdup(remote_core_path);
remote_core_path[0] = '\0';
net_http_urlencode_full(
remote_core_path, tmp_url, sizeof(remote_core_path));
@ -453,7 +453,7 @@ static bool core_updater_list_set_paths(
entry->remote_core_path = strdup(remote_core_path);
fill_pathname_join(
fill_pathname_join_special(
local_core_path,
path_dir_libretro,
filename_str,
@ -473,7 +473,7 @@ static bool core_updater_list_set_paths(
entry->local_core_path = strdup(local_core_path);
fill_pathname_join(
fill_pathname_join_special(
local_info_path,
path_libretro_info,
filename_str,

View File

@ -267,7 +267,7 @@ bool disk_index_file_init(
}
/* > Generate final path */
fill_pathname_join(
fill_pathname_join_special(
disk_index_file_path, disk_index_file_dir,
content_name, sizeof(disk_index_file_path));
strlcat(

View File

@ -171,9 +171,9 @@ void fill_pathname_application_special(char *s,
char s8[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join(s, s1, "png", len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
}
#endif
break;
@ -191,10 +191,10 @@ void fill_pathname_application_special(char *s,
char s8[PATH_MAX_LENGTH];
char s3[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join(s3, s1, "png", sizeof(s3));
fill_pathname_join(s, s3, FILE_PATH_BACKGROUND_IMAGE, len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s3, s1, "png", sizeof(s3));
fill_pathname_join_special(s, s3, FILE_PATH_BACKGROUND_IMAGE, len);
}
}
#endif
@ -211,9 +211,9 @@ void fill_pathname_application_special(char *s,
{
char s8[PATH_MAX_LENGTH];
char s4[PATH_MAX_LENGTH];
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s4, s8, xmb_theme_ident(), sizeof(s4));
fill_pathname_join(s, s4, "sounds", len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s4, s8, xmb_theme_ident(), sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
}
else
#endif
@ -221,8 +221,8 @@ void fill_pathname_application_special(char *s,
if (string_is_equal(menu_ident, "glui"))
{
char s4[PATH_MAX_LENGTH];
fill_pathname_join(s4, dir_assets, "glui", sizeof(s4));
fill_pathname_join(s, s4, "sounds", len);
fill_pathname_join_special(s4, dir_assets, "glui", sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
}
else
#endif
@ -230,14 +230,14 @@ void fill_pathname_application_special(char *s,
if (string_is_equal(menu_ident, "ozone"))
{
char s4[PATH_MAX_LENGTH];
fill_pathname_join(s4, dir_assets, "ozone",
fill_pathname_join_special(s4, dir_assets, "ozone",
sizeof(s4));
fill_pathname_join(s, s4, "sounds", len);
fill_pathname_join_special(s, s4, "sounds", len);
}
else
#endif
{
fill_pathname_join(
fill_pathname_join_special(
s, dir_assets, "sounds", len);
}
#endif
@ -256,9 +256,9 @@ void fill_pathname_application_special(char *s,
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join(s, s1, "png", len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
}
else
#endif
@ -271,14 +271,14 @@ void fill_pathname_application_special(char *s,
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
#endif
fill_pathname_join(s, s5, s6, len);
fill_pathname_join_special(s, s5, s6, len);
}
else if (len)
s[0] = '\0';
@ -296,14 +296,14 @@ void fill_pathname_application_special(char *s,
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
#endif
fill_pathname_join(s, s5, s6, len);
fill_pathname_join_special(s, s5, s6, len);
}
#endif
break;
@ -314,8 +314,8 @@ void fill_pathname_application_special(char *s,
char s7[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s7, dir_assets, "rgui", sizeof(s7));
fill_pathname_join(s, s7, "font", len);
fill_pathname_join_special(s7, dir_assets, "rgui", sizeof(s7));
fill_pathname_join_special(s, s7, "font", len);
}
#endif
break;
@ -326,8 +326,8 @@ void fill_pathname_application_special(char *s,
char s8[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s, s8, xmb_theme_ident(), len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s, s8, xmb_theme_ident(), len);
}
#endif
break;
@ -347,29 +347,29 @@ void fill_pathname_application_special(char *s,
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join(s9,
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join(s, s9, "fallback-font.ttf", len);
fill_pathname_join_special(s, s9, "fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join(s9,
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join(s, s9, "chinese-fallback-font.ttf", len);
fill_pathname_join_special(s, s9, "chinese-fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join(s9,
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join(s, s9, "korean-fallback-font.ttf", len);
fill_pathname_join_special(s, s9, "korean-fallback-font.ttf", len);
break;
default:
{
char s8[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join(s9, s8, xmb_theme_ident(), sizeof(s9));
fill_pathname_join(s, s9, FILE_PATH_TTF_FONT, len);
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s9, s8, xmb_theme_ident(), sizeof(s9));
fill_pathname_join_special(s, s9, FILE_PATH_TTF_FONT, len);
}
break;
}
@ -382,8 +382,8 @@ void fill_pathname_application_special(char *s,
char s10[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join(s10, dir_thumbnails, "discord", sizeof(s10));
fill_pathname_join(s, s10, "avatars", len);
fill_pathname_join_special(s10, dir_thumbnails, "discord", sizeof(s10));
fill_pathname_join_special(s, s10, "avatars", len);
}
break;
@ -392,8 +392,8 @@ void fill_pathname_application_special(char *s,
char s12[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join(s12, dir_thumbnails, "cheevos", len);
fill_pathname_join(s, s12, "badges", len);
fill_pathname_join_special(s12, dir_thumbnails, "cheevos", len);
fill_pathname_join_special(s, s12, "badges", len);
}
break;

View File

@ -326,6 +326,7 @@ static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
static void frontend_darwin_get_env(int *argc, char *argv[],
void *args, void *params_data)
{
char assets_zip_path[PATH_MAX_LENGTH];
CFURLRef bundle_url;
CFStringRef bundle_path;
CFURLRef resource_url;
@ -339,7 +340,7 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
char temp_dir[PATH_MAX_LENGTH] = {0};
char bundle_path_buf[PATH_MAX_LENGTH] = {0};
char resource_path_buf[PATH_MAX_LENGTH] = {0};
char full_resource_path_buf[PATH_MAX_LENGTH] = {0};
char full_resource_path_buf[PATH_MAX_LENGTH];
char home_dir_buf[PATH_MAX_LENGTH] = {0};
CFBundleRef bundle = CFBundleGetMainBundle();
@ -359,7 +360,7 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
CFStringGetCString(resource_path,
resource_path_buf, sizeof(resource_path_buf), kCFStringEncodingUTF8);
CFRelease(resource_path);
fill_pathname_join(full_resource_path_buf, bundle_path_buf, resource_path_buf, sizeof(full_resource_path_buf));
fill_pathname_join_special(full_resource_path_buf, bundle_path_buf, resource_path_buf, sizeof(full_resource_path_buf));
CFSearchPathForDirectoriesInDomains(
home_dir_buf, sizeof(home_dir_buf));
@ -454,7 +455,6 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
#endif
char assets_zip_path[PATH_MAX_LENGTH];
#if TARGET_OS_IOS
{
int major, minor;
@ -465,9 +465,9 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
#endif
#if TARGET_OS_IOS
fill_pathname_join(assets_zip_path, bundle_path_buf, "assets.zip", sizeof(assets_zip_path));
fill_pathname_join_special(assets_zip_path, bundle_path_buf, "assets.zip", sizeof(assets_zip_path));
#else
fill_pathname_join(assets_zip_path, full_resource_path_buf, "assets.zip", sizeof(assets_zip_path));
fill_pathname_join_special(assets_zip_path, full_resource_path_buf, "assets.zip", sizeof(assets_zip_path));
#endif
if (path_is_valid(assets_zip_path))

View File

@ -54,7 +54,7 @@ static void frontend_dos_get_env_settings(int *argc, char *argv[],
void *data, void *params_data)
{
char *slash;
char base_path[PATH_MAX] = {0};
char base_path[PATH_MAX];
retro_main_log_file_init("retrodos.txt", false);

View File

@ -73,12 +73,14 @@ void cmd_take_screenshot(void)
static void frontend_emscripten_get_env(int *argc, char *argv[],
void *args, void *params_data)
{
char base_path[PATH_MAX] = {0};
char user_path[PATH_MAX] = {0};
char base_path[PATH_MAX];
char user_path[PATH_MAX];
const char *home = getenv("HOME");
if (home)
{
base_path[0] = '\0';
user_path[0] = '\0';
snprintf(base_path, sizeof(base_path),
"%s/retroarch", home);
snprintf(user_path, sizeof(user_path),
@ -86,8 +88,8 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
}
else
{
snprintf(base_path, sizeof(base_path), "retroarch");
snprintf(user_path, sizeof(user_path), "retroarch/userdata");
strlcpy(base_path, "retroarch", sizeof(base_path));
strlcpy(user_path, "retroarch/userdata", sizeof(user_path));
}
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], base_path,

View File

@ -56,17 +56,21 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
void *data, void *params_data)
{
unsigned i;
char data_assets_path[PATH_MAX] = {0};
char assets_path[PATH_MAX] = {0};
char data_path[PATH_MAX] = {0};
char user_path[PATH_MAX] = {0};
char tmp_path[PATH_MAX] = {0};
char assets_path[PATH_MAX];
char data_path[PATH_MAX];
char user_path[PATH_MAX];
char tmp_path[PATH_MAX];
char data_assets_path[PATH_MAX];
char workdir[PATH_MAX] = {0};
getcwd(workdir, sizeof(workdir));
if(!string_is_empty(workdir))
{
assets_path[0] = '\0';
data_path[0] = '\0';
user_path[0] = '\0';
tmp_path[0] = '\0';
snprintf(assets_path, sizeof(data_path),
"%s/app/native/assets", workdir);
snprintf(data_path, sizeof(data_path),
@ -78,10 +82,10 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
}
else
{
snprintf(assets_path, sizeof(data_path), "app/native/assets");
snprintf(data_path, sizeof(data_path), "data");
snprintf(user_path, sizeof(user_path), "shared/misc/retroarch");
snprintf(tmp_path, sizeof(user_path), "tmp");
strlcpy(assets_path, "app/native/assets", sizeof(assets_path));
strlcpy(data_path, "data", sizeof(data_path));
strlcpy(user_path, "shared/misc/retroarch", sizeof(user_path));
strlcpy(tmp_path, "tmp", sizeof(user_path));
}
/* app data */
@ -143,9 +147,8 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));
/* bundle copy */
snprintf(data_assets_path,
sizeof(data_assets_path),
"%s/%s", data_path, "assets");
fill_pathname_join_special(data_assets_path,
data_path, "assets", sizeof(data_assets_path));
if (!filestream_exists(data_assets_path))
{
@ -162,7 +165,7 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[],
}
/* set GLUI as default menu */
snprintf(g_defaults.settings_menu, sizeof(g_defaults.settings_menu), "glui");
strlcpy(g_defaults.settings_menu, "glui", sizeof(g_defaults.settings_menu));
#ifndef IS_SALAMANDER
dir_check_defaults("custom.ini");

View File

@ -1,3 +1,19 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stddef.h>
#include <string.h>

View File

@ -161,9 +161,9 @@ int system_property_get(const char *command,
const char *args, char *value)
{
FILE *pipe;
char cmd[NAME_MAX_LENGTH];
int length = 0;
char buffer[PATH_MAX_LENGTH] = {0};
char cmd[NAME_MAX_LENGTH] = {0};
char *curpos = NULL;
size_t buf_pos = strlcpy(cmd, command, sizeof(cmd));
@ -622,13 +622,13 @@ static bool device_is_android_tv()
bool test_permissions(const char *path)
{
char buf[PATH_MAX_LENGTH];
bool ret = false;
char buf[PATH_MAX_LENGTH] = {0};
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "Testing permissions for %s\n",path);
fill_pathname_join(buf, path, ".retroarch", sizeof(buf));
fill_pathname_join_special(buf, path, ".retroarch", sizeof(buf));
ret = path_mkdir(buf);
__android_log_print(ANDROID_LOG_INFO,
@ -2156,7 +2156,7 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
if (storage_permissions == INTERNAL_STORAGE_WRITABLE)
{
char user_data_path[PATH_MAX_LENGTH];
fill_pathname_join(user_data_path,
fill_pathname_join_special(user_data_path,
internal_storage_path, "RetroArch",
sizeof(user_data_path));
@ -2390,9 +2390,7 @@ static uint64_t frontend_unix_get_total_mem(void)
line[0] = '\0';
/* Open /proc/meminfo */
meminfo_file = fopen(PROC_MEMINFO_PATH, "r");
if (!meminfo_file)
if (!(meminfo_file = fopen(PROC_MEMINFO_PATH, "r")))
return 0;
/* Parse lines
@ -2438,9 +2436,7 @@ static uint64_t frontend_unix_get_free_mem(void)
line[0] = '\0';
/* Open /proc/meminfo */
meminfo_file = fopen(PROC_MEMINFO_PATH, "r");
if (!meminfo_file)
if (!(meminfo_file = fopen(PROC_MEMINFO_PATH, "r")))
return 0;
/* Parse lines

View File

@ -125,7 +125,6 @@ static void salamander_init(char *s, size_t len)
char config_path[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
config_path[0] = '\0';
config_dir[0] = '\0';
/* Get salamander config file path */
@ -135,7 +134,7 @@ static void salamander_init(char *s, size_t len)
FILE_PATH_SALAMANDER_CONFIG,
sizeof(config_path));
else
strcpy_literal(config_path, FILE_PATH_SALAMANDER_CONFIG);
strlcpy(config_path, FILE_PATH_SALAMANDER_CONFIG, sizeof(config_path));
/* Ensure that config directory exists */
fill_pathname_parent_dir(config_dir, config_path, sizeof(config_dir));
@ -144,9 +143,7 @@ static void salamander_init(char *s, size_t len)
path_mkdir(config_dir);
/* Attempt to open config file */
config = config_file_new_from_path_to_string(config_path);
if (config)
if ((config = config_file_new_from_path_to_string(config_path)))
{
char libretro_path[PATH_MAX_LENGTH];

View File

@ -80,9 +80,6 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
size_t symbol_index;
size_t i, j;
font_dir[0] = '\0';
font_path[0] = '\0';
/* Get font file associated with
* specified language */
switch (language)
@ -131,7 +128,7 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
/* Get font path */
fill_pathname_application_special(font_dir, sizeof(font_dir),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT);
fill_pathname_join(font_path, font_dir, font_file,
fill_pathname_join_special(font_path, font_dir, font_file,
sizeof(font_path));
/* Attempt to read bitmap file */

View File

@ -67,9 +67,6 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
size_t symbol_index;
size_t i, j;
font_dir[0] = '\0';
font_path[0] = '\0';
/* Get font file associated with
* specified language */
switch (language)
@ -131,7 +128,7 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
/* Get font path */
fill_pathname_application_special(font_dir, sizeof(font_dir),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT);
fill_pathname_join(font_path, font_dir, font_file,
fill_pathname_join_special(font_path, font_dir, font_file,
sizeof(font_path));
/* Attempt to read bitmap file */
@ -153,8 +150,7 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
num_glyphs = (glyph_max - glyph_min) + 1;
/* Initialise font struct */
font = (bitmapfont_lut_t*)calloc(1, sizeof(bitmapfont_lut_t));
if (!font)
if (!(font = (bitmapfont_lut_t*)calloc(1, sizeof(bitmapfont_lut_t))))
goto error;
font->glyph_min = glyph_min;
@ -163,8 +159,7 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
/* Note: Need to use a calloc() here, otherwise
* we'll get undefined behaviour when calling
* bitmapfont_free_lut() if the following loop fails */
font->lut = (bool**)calloc(1, num_glyphs * sizeof(bool*));
if (!font->lut)
if (!(font->lut = (bool**)calloc(1, num_glyphs * sizeof(bool*))))
goto error;
/* Loop over all possible characters */

View File

@ -1207,7 +1207,8 @@ bool gfx_display_reset_textures_list(
if (string_is_empty(texture_path))
return false;
fill_pathname_join(texpath, iconpath, texture_path, sizeof(texpath));
fill_pathname_join_special(texpath,
iconpath, texture_path, sizeof(texpath));
if (!image_texture_load(&ti, texpath))
return false;

View File

@ -405,7 +405,7 @@ bool gfx_thumbnail_set_content_image(
path_data->content_img, sizeof(path_data->content_label));
/* Set file path */
fill_pathname_join(path_data->content_path,
fill_pathname_join_special(path_data->content_path,
img_dir, img_name, sizeof(path_data->content_path));
/* Set core name to "imageviewer" */
@ -645,15 +645,15 @@ bool gfx_thumbnail_update_path(
/* > Normal content: assemble path */
/* >> Base + system name */
fill_pathname_join(thumbnail_path, dir_thumbnails,
fill_pathname_join_special(thumbnail_path, dir_thumbnails,
system_name, PATH_MAX_LENGTH * sizeof(char));
/* >> Add type */
fill_pathname_join(tmp_buf, thumbnail_path, type, sizeof(tmp_buf));
fill_pathname_join_special(tmp_buf, thumbnail_path, type, sizeof(tmp_buf));
/* >> Add content image */
thumbnail_path[0] = '\0';
fill_pathname_join(thumbnail_path, tmp_buf,
fill_pathname_join_special(thumbnail_path, tmp_buf,
path_data->content_img, PATH_MAX_LENGTH * sizeof(char));
}

View File

@ -810,14 +810,14 @@ static void gfx_widgets_layout(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "fallback-font.ttf", sizeof(font_file));
fill_pathname_join_special(font_file, p_dispwidget->assets_pkg_dir, "fallback-font.ttf", sizeof(font_file));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "chinese-fallback-font.ttf", sizeof(font_file));
fill_pathname_join_special(font_file, p_dispwidget->assets_pkg_dir, "chinese-fallback-font.ttf", sizeof(font_file));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join(font_file, p_dispwidget->assets_pkg_dir, "korean-fallback-font.ttf", sizeof(font_file));
fill_pathname_join_special(font_file, p_dispwidget->assets_pkg_dir, "korean-fallback-font.ttf", sizeof(font_file));
break;
default:
strlcpy(font_file, p_dispwidget->ozone_regular_font_path, sizeof(font_file));
@ -2019,42 +2019,42 @@ bool gfx_widgets_init(
p_dispwidget->current_msgs_lock = slock_new();
#endif
fill_pathname_join(
fill_pathname_join_special(
p_dispwidget->gfx_widgets_path,
dir_assets,
"menu_widgets",
sizeof(p_dispwidget->gfx_widgets_path)
);
fill_pathname_join(
fill_pathname_join_special(
p_dispwidget->xmb_path,
dir_assets,
"xmb",
sizeof(p_dispwidget->xmb_path)
);
/* Base path */
fill_pathname_join(p_dispwidget->ozone_path,
fill_pathname_join_special(p_dispwidget->ozone_path,
dir_assets,
"ozone",
sizeof(p_dispwidget->ozone_path));
fill_pathname_join(p_dispwidget->ozone_regular_font_path,
fill_pathname_join_special(p_dispwidget->ozone_regular_font_path,
p_dispwidget->ozone_path, "regular.ttf",
sizeof(p_dispwidget->ozone_regular_font_path));
fill_pathname_join(p_dispwidget->ozone_bold_font_path,
fill_pathname_join_special(p_dispwidget->ozone_bold_font_path,
p_dispwidget->ozone_path, "bold.ttf",
sizeof(p_dispwidget->ozone_bold_font_path));
fill_pathname_join(
fill_pathname_join_special(
theme_path,
p_dispwidget->xmb_path,
"monochrome",
sizeof(theme_path)
);
fill_pathname_join(
fill_pathname_join_special(
p_dispwidget->monochrome_png_path,
theme_path,
"png",
sizeof(p_dispwidget->monochrome_png_path)
);
fill_pathname_join(p_dispwidget->assets_pkg_dir,
fill_pathname_join_special(p_dispwidget->assets_pkg_dir,
settings->paths.directory_assets, "pkg",
sizeof(p_dispwidget->assets_pkg_dir));

View File

@ -1776,7 +1776,7 @@ bool video_shader_write_preset(const char *path,
if (!shader || string_is_empty(path))
return false;
fill_pathname_join(preset_dir, shader_dir, "presets", sizeof(preset_dir));
fill_pathname_join_special(preset_dir, shader_dir, "presets", sizeof(preset_dir));
/* If we should still save a referenced preset do it now */
if (reference)
@ -2320,7 +2320,7 @@ void dir_check_shader(
if (shader && !string_is_empty(shader->loaded_preset_path))
{
char last_shader_path[PATH_MAX_LENGTH];
fill_pathname_join(last_shader_path,
fill_pathname_join_special(last_shader_path,
last_shader_preset_dir, last_shader_preset_file_name,
sizeof(last_shader_path));
@ -2398,7 +2398,7 @@ static bool retroarch_load_shader_preset_internal(
if (string_is_empty(special_name))
break;
fill_pathname_join(s, shader_directory, special_name, len);
fill_pathname_join_special(s, shader_directory, special_name, len);
strlcat(s, video_shader_get_preset_extension(types[i]), len);
}
@ -2444,7 +2444,7 @@ bool load_shader_preset(settings_t *settings, const char *core_name,
}
if (!string_is_empty(video_shader_directory))
fill_pathname_join(old_presets_directory,
fill_pathname_join_special(old_presets_directory,
video_shader_directory, "presets", sizeof(old_presets_directory));
else
old_presets_directory[0] = '\0';

View File

@ -453,7 +453,7 @@ bool gfx_widget_start_load_content_animation(void)
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join(icon_path,
fill_pathname_join_special(icon_path,
state->icon_directory, state->icon_file,
sizeof(icon_path));
@ -487,7 +487,7 @@ bool gfx_widget_start_load_content_animation(void)
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join(icon_path,
fill_pathname_join_special(icon_path,
state->icon_directory, state->icon_file,
sizeof(icon_path));
@ -500,7 +500,7 @@ bool gfx_widget_start_load_content_animation(void)
if (!state->has_icon)
{
strlcpy(state->icon_file, "retroarch.png", sizeof(state->icon_file));
fill_pathname_join(icon_path,
fill_pathname_join_special(icon_path,
state->icon_directory, state->icon_file,
sizeof(icon_path));

View File

@ -2924,7 +2924,8 @@ void input_config_set_device_config_path(unsigned port, const char *path)
input_driver_state_t *input_st = &input_driver_st;
if (fill_pathname_parent_dir_name(parent_dir_name,
path, sizeof(parent_dir_name)))
fill_pathname_join(input_st->input_device_info[port].config_path,
fill_pathname_join_special(
input_st->input_device_info[port].config_path,
parent_dir_name, path_basename_nocompression(path),
sizeof(input_st->input_device_info[port].config_path));
}

View File

@ -112,7 +112,7 @@ static int file_archive_extract_cb(const char *name, const char *valid_exts,
}
if (userdata->extraction_directory)
fill_pathname_join(new_path, userdata->extraction_directory,
fill_pathname_join_special(new_path, userdata->extraction_directory,
path_basename(name), sizeof(new_path));
else
fill_pathname_resolve_relative(new_path, userdata->archive_path,

View File

@ -906,13 +906,44 @@ void fill_pathname_resolve_relative(char *out_path,
* Joins a directory (@dir) and path (@path) together.
* Makes sure not to get two consecutive slashes
* between directory and path.
*
* Deprecated. Use fill_pathname_join_special() instead
* if you can ensure @dir and @out_path won't overlap.
*
* @return The length of @out_path (NOT @size)
**/
size_t fill_pathname_join(char *out_path,
const char *dir, const char *path, size_t size)
{
size_t len = 0;
if (out_path != dir)
len = strlcpy(out_path, dir, size);
strlcpy(out_path, dir, size);
if (*out_path)
fill_pathname_slash(out_path, size);
return strlcat(out_path, path, size);
}
/**
* fill_pathname_join_special:
* @out_path : output path
* @dir : directory. Cannot be identical to @out_path
* @path : path
* @size : size of output path
*
*
* Specialized version of fill_pathname_join.
* Unlike fill_pathname_join(),
* @dir and @out_path CANNOT be identical.
*
* Joins a directory (@dir) and path (@path) together.
* Makes sure not to get two consecutive slashes
* between directory and path.
*
* @return The length of @out_path (NOT @size)
**/
size_t fill_pathname_join_special(char *out_path,
const char *dir, const char *path, size_t size)
{
size_t len = strlcpy(out_path, dir, size);
if (*out_path)
{

View File

@ -451,12 +451,43 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
*
* Hidden non-leaf function cost:
* - calls strlcpy
* - calls find_last_slash()
* - calls fill_pathname_slash()
* - calls strlcat
*
* Deprecated. Use fill_pathname_join_special() instead
* if you can ensure @dir != @out_path
*
* @return The length of @out_path (NOT @size)
**/
size_t fill_pathname_join(char *out_path, const char *dir,
const char *path, size_t size);
/**
* fill_pathname_join_special:
* @out_path : output path
* @dir : directory. Cannot be identical to @out_path
* @path : path
* @size : size of output path
*
*
* Specialized version of fill_pathname_join.
* Unlike fill_pathname_join(),
* @dir and @out_path CANNOT be identical.
*
* Joins a directory (@dir) and path (@path) together.
* Makes sure not to get two consecutive slashes
* between directory and path.
*
* Hidden non-leaf function cost:
* - calls strlcpy
* - calls find_last_slash()
* - calls strlcat
*
* @return The length of @out_path (NOT @size)
**/
size_t fill_pathname_join_special(char *out_path,
const char *dir, const char *path, size_t size);
size_t fill_pathname_join_special_ext(char *out_path,
const char *dir, const char *path,
const char *last, const char *ext,

View File

@ -137,7 +137,7 @@ static int dir_list_read(const char *dir,
continue;
}
fill_pathname_join(file_path, dir, name, sizeof(file_path));
fill_pathname_join_special(file_path, dir, name, sizeof(file_path));
if (retro_dirent_is_dir(entry, NULL))
{

View File

@ -157,10 +157,8 @@ int main(int argc, char *argv[])
rand_str(tmp_str, sizeof(tmp_str) - 1);
tmp_str[0] = '.';
out_file_path[0] = '\0';
if (!string_is_empty(in_file_dir))
fill_pathname_join(out_file_path, in_file_dir,
fill_pathname_join_special(out_file_path, in_file_dir,
tmp_str, sizeof(out_file_path));
else
strlcpy(out_file_path, tmp_str, sizeof(out_file_path));

View File

@ -1158,7 +1158,7 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
return false;
#endif
/* dirent struct doesn't have d_type, do it the slow way ... */
fill_pathname_join(path, rdir->orig_path, retro_vfs_dirent_get_name_impl(rdir), sizeof(path));
fill_pathname_join_special(path, rdir->orig_path, retro_vfs_dirent_get_name_impl(rdir), sizeof(path));
if (stat(path, &buf) < 0)
return false;
return S_ISDIR(buf.st_mode);

View File

@ -1056,7 +1056,7 @@ bool manual_content_scan_get_task_config(
if (string_is_empty(path_dir_playlist))
return false;
fill_pathname_join(
fill_pathname_join_special(
task_config->playlist_file,
path_dir_playlist,
task_config->database_name,

View File

@ -315,7 +315,7 @@ static int deferred_push_cursor_manager_list_deferred(
settings = config_get_ptr();
fill_pathname_join(rdb_path,
fill_pathname_join_special(rdb_path,
settings->paths.path_content_database,
rdb_entry->value, sizeof(rdb_path));
@ -424,9 +424,9 @@ static int general_push(menu_displaylist_info_t *info,
{
char tmp_str[PATH_MAX_LENGTH];
char tmp_str2[PATH_MAX_LENGTH];
fill_pathname_join(tmp_str, menu->scratch2_buf,
fill_pathname_join_special(tmp_str, menu->scratch2_buf,
menu->scratch_buf, sizeof(tmp_str));
fill_pathname_join(tmp_str2, menu->scratch2_buf,
fill_pathname_join_special(tmp_str2, menu->scratch2_buf,
menu->scratch_buf, sizeof(tmp_str2));
if (!string_is_empty(info->path))

View File

@ -860,7 +860,7 @@ int generic_action_ok_displaylist_push(const char *path,
content_path = menu->scratch_buf;
}
if (content_path)
fill_pathname_join(menu->detect_content_path,
fill_pathname_join_special(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
@ -879,7 +879,7 @@ int generic_action_ok_displaylist_push(const char *path,
content_path = menu->scratch_buf;
}
if (content_path)
fill_pathname_join(menu->detect_content_path,
fill_pathname_join_special(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
@ -1109,7 +1109,7 @@ int generic_action_ok_displaylist_push(const char *path,
if (!string_is_empty(core_name) && !string_is_empty(settings->paths.directory_input_remapping))
{
fill_pathname_join(tmp,
fill_pathname_join_special(tmp,
settings->paths.directory_input_remapping, core_name, sizeof(tmp));
if (!path_is_directory(tmp))
tmp[0] = '\0';
@ -1218,7 +1218,7 @@ int generic_action_ok_displaylist_push(const char *path,
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
fill_pathname_join(rgui_assets_dir,
fill_pathname_join_special(rgui_assets_dir,
settings->paths.directory_assets, "rgui",
sizeof(rgui_assets_dir));
@ -1326,7 +1326,7 @@ int generic_action_ok_displaylist_push(const char *path,
parent_dir[0] = '\0';
if (path && menu_path)
fill_pathname_join(tmp,
fill_pathname_join_special(tmp,
menu_path, path, sizeof(tmp));
fill_pathname_parent_dir(parent_dir,
@ -1344,7 +1344,7 @@ int generic_action_ok_displaylist_push(const char *path,
if (!string_is_empty(path))
{
if (!string_is_empty(menu_path))
fill_pathname_join(
fill_pathname_join_special(
tmp, menu_path, path, sizeof(tmp));
else
strlcpy(tmp, path, sizeof(tmp));
@ -1360,7 +1360,7 @@ int generic_action_ok_displaylist_push(const char *path,
{
char lpl_basename[PATH_MAX_LENGTH];
filebrowser_clear_type();
fill_pathname_join(tmp,
fill_pathname_join_special(tmp,
settings->paths.path_content_database,
path, sizeof(tmp));
@ -1378,7 +1378,7 @@ int generic_action_ok_displaylist_push(const char *path,
break;
case ACTION_OK_DL_CURSOR_MANAGER_LIST:
filebrowser_clear_type();
fill_pathname_join(tmp, settings->paths.directory_cursor,
fill_pathname_join_special(tmp, settings->paths.directory_cursor,
path, sizeof(tmp));
info.directory_ptr = idx;
@ -1700,7 +1700,7 @@ static bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info
size_t default_info_length = def_info->len;
if (!string_is_empty(default_info_path))
fill_pathname_join(def_info->s,
fill_pathname_join_special(def_info->s,
default_info_dir, default_info_path,
default_info_length);
@ -1796,11 +1796,11 @@ static int file_load_with_detect_core_wrapper(
if (string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)))
fill_pathname_join(menu_path_new,
fill_pathname_join_special(menu_path_new,
menu->scratch2_buf, menu->scratch_buf, sizeof(menu_path_new));
else if (string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN)))
fill_pathname_join(menu_path_new,
fill_pathname_join_special(menu_path_new,
menu->scratch2_buf, menu->scratch_buf, sizeof(menu_path_new));
core_info_get_list(&list);
@ -1818,7 +1818,7 @@ static int file_load_with_detect_core_wrapper(
if ( !is_carchive && !string_is_empty(path)
&& !string_is_empty(menu_path_new))
fill_pathname_join(menu->detect_content_path,
fill_pathname_join_special(menu->detect_content_path,
menu_path_new, path,
sizeof(menu->detect_content_path));
@ -1965,7 +1965,7 @@ static int generic_action_ok(const char *path,
&menu_label, NULL, &enum_idx, NULL);
if (!string_is_empty(path))
fill_pathname_join(action_path,
fill_pathname_join_special(action_path,
menu_path, path, sizeof(action_path));
else
strlcpy(action_path, menu_path, sizeof(action_path));
@ -2298,7 +2298,7 @@ static int action_ok_file_load(const char *path,
if (!menu)
return menu_cbs_exit();
fill_pathname_join(menu_path_new,
fill_pathname_join_special(menu_path_new,
menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
switch (type)
@ -2308,7 +2308,7 @@ static int action_ok_file_load(const char *path,
'#',sizeof(full_path_new));
break;
default:
fill_pathname_join(full_path_new, menu_path_new, path,
fill_pathname_join_special(full_path_new, menu_path_new, path,
sizeof(full_path_new));
break;
}
@ -2342,7 +2342,7 @@ static int action_ok_file_load(const char *path,
if (!menu)
return menu_cbs_exit();
fill_pathname_join(menu_path_new,
fill_pathname_join_special(menu_path_new,
menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
}
@ -2355,7 +2355,7 @@ static int action_ok_file_load(const char *path,
'#',sizeof(full_path_new));
break;
default:
fill_pathname_join(full_path_new, menu_path_new, path,
fill_pathname_join_special(full_path_new, menu_path_new, path,
sizeof(full_path_new));
break;
}
@ -2902,7 +2902,7 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
if (!menu)
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
/* The push function reads our entry as const,
@ -2932,7 +2932,7 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
if (!menu)
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
/* the push function reads our entry as const, so these casts are safe */
@ -3921,11 +3921,10 @@ static int action_ok_file_load_ffmpeg(const char *path,
file_list_get_last(menu_stack, &menu_path, NULL, NULL, NULL);
new_path[0] = '\0';
if (!string_is_empty(menu_path))
fill_pathname_join(new_path, menu_path, path,
sizeof(new_path));
if (string_is_empty(menu_path))
return -1;
fill_pathname_join_special(new_path, menu_path, path,
sizeof(new_path));
/* TODO/FIXME - should become runtime optional */
#ifdef HAVE_MPV
@ -3946,7 +3945,7 @@ static int action_ok_audio_run(const char *path,
if (!menu)
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
/* TODO/FIXME - should become runtime optional */
@ -4366,7 +4365,7 @@ static int action_ok_file_load_imageviewer(const char *path,
fullpath[0] = '\0';
if (!string_is_empty(menu_path))
fill_pathname_join(fullpath, menu_path, path,
fill_pathname_join_special(fullpath, menu_path, path,
sizeof(fullpath));
return default_action_ok_load_content_with_core_from_menu(fullpath, CORE_TYPE_IMAGEVIEWER);
@ -4707,7 +4706,7 @@ static int generic_action_ok_network(const char *path,
if (string_is_empty(network_buildbot_assets_url))
return menu_cbs_exit();
fill_pathname_join(url_path,
fill_pathname_join_special(url_path,
network_buildbot_assets_url,
"cores/" FILE_PATH_INDEX_DIRS_URL,
sizeof(url_path));
@ -4717,7 +4716,7 @@ static int generic_action_ok_network(const char *path,
suppress_msg = true;
break;
case MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST:
fill_pathname_join(url_path, path,
fill_pathname_join_special(url_path, path,
FILE_PATH_INDEX_URL, sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
type_id2 = ACTION_OK_DL_CORE_CONTENT_LIST;
@ -4727,7 +4726,7 @@ static int generic_action_ok_network(const char *path,
case MENU_ENUM_LABEL_CB_CORE_SYSTEM_FILES_LIST:
if (string_is_empty(network_buildbot_assets_url))
return menu_cbs_exit();
fill_pathname_join(url_path,
fill_pathname_join_special(url_path,
network_buildbot_assets_url,
"system/" FILE_PATH_INDEX_URL,
sizeof(url_path));
@ -4737,7 +4736,7 @@ static int generic_action_ok_network(const char *path,
suppress_msg = true;
break;
case MENU_ENUM_LABEL_CB_THUMBNAILS_UPDATER_LIST:
fill_pathname_join(url_path,
fill_pathname_join_special(url_path,
FILE_PATH_CORE_THUMBNAILPACKS_URL,
FILE_PATH_INDEX_URL, sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
@ -4747,10 +4746,10 @@ static int generic_action_ok_network(const char *path,
#ifdef HAVE_LAKKA
case MENU_ENUM_LABEL_CB_LAKKA_LIST:
/* TODO unhardcode this path */
fill_pathname_join(url_path,
fill_pathname_join_special(url_path,
FILE_PATH_LAKKA_URL,
lakka_get_project(), sizeof(url_path));
fill_pathname_join(url_path, url_path,
fill_pathname_join_special(url_path, url_path,
FILE_PATH_INDEX_URL,
sizeof(url_path));
url_label = msg_hash_to_str(enum_idx);
@ -4875,7 +4874,7 @@ void cb_generic_download(retro_task_t *task,
break;
}
fill_pathname_join(shaderdir, dir_video_shader,
fill_pathname_join_special(shaderdir, dir_video_shader,
dirname, sizeof(shaderdir));
if (!path_is_directory(shaderdir) && !path_mkdir(shaderdir))
@ -4900,7 +4899,7 @@ void cb_generic_download(retro_task_t *task,
}
if (!string_is_empty(dir_path))
fill_pathname_join(output_path, dir_path,
fill_pathname_join_special(output_path, dir_path,
transf->path, sizeof(output_path));
/* Make sure the directory exists
@ -4917,7 +4916,7 @@ void cb_generic_download(retro_task_t *task,
}
if (!string_is_empty(dir_path))
fill_pathname_join(output_path, dir_path,
fill_pathname_join_special(output_path, dir_path,
transf->path, sizeof(output_path));
#ifdef HAVE_COMPRESSION
@ -4995,7 +4994,7 @@ static int action_ok_download_generic(const char *path,
s3[0] = '\0';
fill_pathname_join(s,
fill_pathname_join_special(s,
network_buildbot_assets_url,
"frontend", sizeof(s));
@ -5003,7 +5002,7 @@ static int action_ok_download_generic(const char *path,
{
case MENU_ENUM_LABEL_CB_DOWNLOAD_URL:
suppress_msg = true;
fill_pathname_join(s, label,
fill_pathname_join_special(s, label,
path, sizeof(s));
path = s;
cb = cb_generic_dir_download;
@ -5019,14 +5018,14 @@ static int action_ok_download_generic(const char *path,
}
break;
case MENU_ENUM_LABEL_CB_CORE_SYSTEM_FILES_DOWNLOAD:
fill_pathname_join(s,
fill_pathname_join_special(s,
network_buildbot_assets_url,
"system", sizeof(s));
break;
case MENU_ENUM_LABEL_CB_LAKKA_DOWNLOAD:
#ifdef HAVE_LAKKA
/* TODO unhardcode this path*/
fill_pathname_join(s, FILE_PATH_LAKKA_URL,
fill_pathname_join_special(s, FILE_PATH_LAKKA_URL,
lakka_get_project(), sizeof(s));
#endif
break;
@ -5065,7 +5064,7 @@ static int action_ok_download_generic(const char *path,
break;
}
fill_pathname_join(s2, s, path, sizeof(s2));
fill_pathname_join_special(s2, s, path, sizeof(s2));
transf = (file_transfer_t*)calloc(1, sizeof(*transf));
transf->enum_idx = enum_idx;
@ -5184,7 +5183,7 @@ static int action_ok_sideload_core(const char *path,
&menu_path, NULL, NULL, NULL, NULL);
if (!string_is_empty(menu_path))
fill_pathname_join(
fill_pathname_join_special(
backup_path, menu_path, core_file, sizeof(backup_path));
else
strlcpy(backup_path, core_file, sizeof(backup_path));
@ -6954,7 +6953,7 @@ static int action_ok_load_archive(const char *path,
menu_path = menu->scratch2_buf;
content_path = menu->scratch_buf;
fill_pathname_join(menu->detect_content_path,
fill_pathname_join_special(menu->detect_content_path,
menu_path, content_path,
sizeof(menu->detect_content_path));
@ -6997,7 +6996,8 @@ static int action_ok_load_archive_detect_core(const char *path,
new_core_path, sizeof(new_core_path)))
ret = -1;
fill_pathname_join(menu->detect_content_path, menu_path, content_path,
fill_pathname_join_special(
menu->detect_content_path, menu_path, content_path,
sizeof(menu->detect_content_path));
switch (ret)
@ -7292,7 +7292,7 @@ static int action_ok_disk_image_append(const char *path,
if (!string_is_empty(menu_path))
{
if (!string_is_empty(path))
fill_pathname_join(image_path,
fill_pathname_join_special(image_path,
menu_path, path, sizeof(image_path));
else
strlcpy(image_path, menu_path, sizeof(image_path));
@ -7746,9 +7746,7 @@ static int action_ok_pl_content_thumbnails(const char *path,
if (!string_is_empty(path_dir_playlist))
{
char playlist_path[PATH_MAX_LENGTH];
playlist_path[0] = '\0';
fill_pathname_join(
fill_pathname_join_special(
playlist_path, path_dir_playlist, label,
sizeof(playlist_path));
playlist_config_set_path(&playlist_config, playlist_path);
@ -7903,13 +7901,9 @@ static int action_ok_playlist_refresh(const char *path,
if (!scan_record_valid)
{
char msg[PATH_MAX_LENGTH];
msg[0] = '\0';
if (string_is_empty(msg_subject))
msg_subject = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE);
fill_pathname_join(msg, msg_prefix, msg_subject, sizeof(msg));
fill_pathname_join_special(msg, msg_prefix, msg_subject, sizeof(msg));
RARCH_ERR(log_text, msg_subject);
runloop_msg_queue_push(msg, 1, 150, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);

View File

@ -58,7 +58,7 @@ int action_scan_file(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath));
fill_pathname_join_special(fullpath, menu_path, path, sizeof(fullpath));
task_push_dbscan(
directory_playlist,
@ -83,7 +83,7 @@ int action_scan_directory(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
if (path)
fill_pathname_join(fullpath, menu_path, path, sizeof(fullpath));
fill_pathname_join_special(fullpath, menu_path, path, sizeof(fullpath));
else
strlcpy(fullpath, menu_path, sizeof(fullpath));

View File

@ -7743,33 +7743,32 @@ static void materialui_init_font(
}
{
char s1[PATH_MAX_LENGTH];
s1[0] = '\0';
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(fontpath, s1, "fallback-font.ttf",
fill_pathname_join_special(fontpath, s1, "fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(fontpath, s1, "chinese-fallback-font.ttf",
fill_pathname_join_special(fontpath, s1, "chinese-fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(fontpath, s1, "korean-fallback-font.ttf",
fill_pathname_join_special(fontpath, s1, "korean-fallback-font.ttf",
sizeof(fontpath));
break;
default:
fill_pathname_join(s1, dir_assets, "glui", sizeof(s1));
fill_pathname_join(fontpath, s1, FILE_PATH_TTF_FONT,
fill_pathname_join_special(s1, dir_assets, "glui", sizeof(s1));
fill_pathname_join_special(fontpath, s1, FILE_PATH_TTF_FONT,
sizeof(fontpath));
break;
}
@ -8084,7 +8083,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
fill_pathname_application_special(mui->sysicons_path,
sizeof(mui->sysicons_path),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
fill_pathname_join(mui->icons_path, dir_assets, "glui",
fill_pathname_join_special(mui->icons_path, dir_assets, "glui",
sizeof(mui->icons_path));
p_anim->updatetime_cb = materialui_menu_animation_update_time;

View File

@ -2581,7 +2581,7 @@ static bool ozone_reset_theme_textures(ozone_handle_t *ozone)
if (!theme->name)
continue;
fill_pathname_join(
fill_pathname_join_special(
theme_path,
ozone->png_path,
theme->name,
@ -4478,7 +4478,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
fill_pathname_base(sysname, path, sizeof(sysname));
path_remove_extension(sysname);
len = fill_pathname_join(texturepath, ozone->icons_path, sysname,
len = fill_pathname_join_special(texturepath, ozone->icons_path, sysname,
sizeof(texturepath));
texturepath[len] = '.';
texturepath[len+1] = 'p';
@ -4489,7 +4489,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
/* If the playlist icon doesn't exist return default */
if (!path_is_valid(texturepath))
{
len = fill_pathname_join(texturepath, ozone->icons_path, "default",
len = fill_pathname_join_special(texturepath, ozone->icons_path, "default",
sizeof(texturepath));
texturepath[len] = '.';
texturepath[len+1] = 'p';
@ -4517,7 +4517,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
fill_pathname_join_delim(sysname, sysname,
"content.png", '-', sizeof(sysname));
fill_pathname_join(content_texturepath, ozone->icons_path, sysname,
fill_pathname_join_special(content_texturepath, ozone->icons_path, sysname,
sizeof(content_texturepath));
/* If the content icon doesn't exist, return default-content */
@ -7824,7 +7824,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
ozone->last_onscreen_category = 0;
/* Assets path */
fill_pathname_join(
fill_pathname_join_special(
ozone->assets_path,
directory_assets,
"ozone",
@ -7832,7 +7832,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
);
/* PNG path */
fill_pathname_join(
fill_pathname_join_special(
ozone->png_path,
ozone->assets_path,
"png",
@ -7840,7 +7840,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
);
/* Sidebar path */
fill_pathname_join(
fill_pathname_join_special(
ozone->tab_path,
ozone->png_path,
"sidebar",
@ -7851,7 +7851,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
fill_pathname_application_special(ozone->icons_path,
sizeof(ozone->icons_path),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
fill_pathname_join(ozone->icons_path_default, ozone->icons_path,
fill_pathname_join_special(ozone->icons_path_default, ozone->icons_path,
"default", sizeof(ozone->icons_path_default));
ozone_last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme;
@ -8070,8 +8070,6 @@ static void ozone_set_layout(
bool font_inited = false;
float scale_factor = ozone->last_scale_factor;
s1[0] = '\0';
/* Calculate dimensions */
ozone->dimensions.header_height = HEADER_HEIGHT * scale_factor;
ozone->dimensions.footer_height = FOOTER_HEIGHT * scale_factor;
@ -8129,23 +8127,23 @@ static void ozone_set_layout(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
break;
default:
fill_pathname_join(font_path, ozone->assets_path, "bold.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, ozone->assets_path, "bold.ttf", sizeof(font_path));
}
font_inited = ozone_init_font(&ozone->fonts.title,
@ -8156,23 +8154,23 @@ static void ozone_set_layout(
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "chinese-fallback-font.ttf", sizeof(font_path));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join(s1,
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, s1, "korean-fallback-font.ttf", sizeof(font_path));
break;
default:
fill_pathname_join(font_path, ozone->assets_path, "regular.ttf", sizeof(font_path));
fill_pathname_join_special(font_path, ozone->assets_path, "regular.ttf", sizeof(font_path));
}
font_inited = ozone_init_font(&ozone->fonts.footer,

View File

@ -2901,7 +2901,7 @@ static void update_dynamic_theme_path(rgui_t *rgui, const char *theme_dir)
if (rgui->is_playlist && !string_is_empty(rgui->menu_title))
{
size_t len = fill_pathname_join(rgui->theme_dynamic_path, theme_dir,
size_t len = fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir,
rgui->menu_title, sizeof(rgui->theme_dynamic_path));
rgui->theme_dynamic_path[len ] = '.';
rgui->theme_dynamic_path[len+1] = 'c';
@ -2913,7 +2913,7 @@ static void update_dynamic_theme_path(rgui_t *rgui, const char *theme_dir)
}
if (!use_playlist_theme)
fill_pathname_join(rgui->theme_dynamic_path, theme_dir,
fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir,
"default.cfg", sizeof(rgui->theme_dynamic_path));
}

View File

@ -1100,7 +1100,7 @@ static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
if (tmp)
{
len = fill_pathname_join(
len = fill_pathname_join_special(
path,
dir_dynamic_wallpapers,
tmp,
@ -2276,10 +2276,9 @@ static void xmb_context_reset_horizontal_list(
RHMAP_FREE(xmb->playlist_db_node_map);
iconpath[0] = '\0';
fill_pathname_application_special(iconpath, sizeof(iconpath),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS);
fill_pathname_join(icons_path_default, iconpath,
fill_pathname_join_special(icons_path_default, iconpath,
"default", sizeof(icons_path_default));
for (i = 0; i < list_size; i++)
@ -2310,7 +2309,7 @@ static void xmb_context_reset_horizontal_list(
fill_pathname_base(sysname, path, sizeof(sysname));
path_remove_extension(sysname);
len = fill_pathname_join(texturepath, iconpath, sysname,
len = fill_pathname_join_special(texturepath, iconpath, sysname,
sizeof(texturepath));
texturepath[len ] = '.';
texturepath[len+1] = 'p';
@ -2322,7 +2321,7 @@ static void xmb_context_reset_horizontal_list(
if (!path_is_valid(texturepath))
{
len = fill_pathname_join(texturepath, iconpath, "default",
len = fill_pathname_join_special(texturepath, iconpath, "default",
sizeof(texturepath));
texturepath[len ] = '.';
texturepath[len+1] = 'p';
@ -2351,7 +2350,7 @@ static void xmb_context_reset_horizontal_list(
fill_pathname_join_delim(sysname, sysname,
FILE_PATH_CONTENT_BASENAME, '-',
sizeof(sysname));
fill_pathname_join(content_texturepath, iconpath, sysname,
fill_pathname_join_special(content_texturepath, iconpath, sysname,
sizeof(content_texturepath));
/* If the content icon doesn't exist return default-content */
@ -6797,7 +6796,7 @@ static void xmb_context_reset_background(xmb_handle_t *xmb, const char *iconpath
}
else if (!string_is_empty(iconpath))
{
fill_pathname_join(path, iconpath,
fill_pathname_join_special(path, iconpath,
FILE_PATH_BACKGROUND_IMAGE, sizeof(path));
if (path_is_valid(path))

View File

@ -265,8 +265,6 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
char icon_path[PATH_MAX_LENGTH];
size_t i;
icon_directory[0] = '\0';
if (!state)
return;
@ -289,7 +287,7 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
return;
/* Load fallback icon */
fill_pathname_join(icon_path, icon_directory,
fill_pathname_join_special(icon_path, icon_directory,
CONTENTLESS_CORE_ICON_DEFAULT, sizeof(icon_path));
if (path_is_valid(icon_path))
@ -325,14 +323,19 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
core_info->databases_list &&
(core_info->databases_list->size > 0))
{
size_t len;
const char *icon_name =
core_info->databases_list->elems[0].data;
struct texture_image ti = {0};
ti.supports_rgba = rgba_supported;
fill_pathname_join(icon_path, icon_directory,
fill_pathname_join_special(icon_path, icon_directory,
icon_name, sizeof(icon_path));
strlcat(icon_path, ".png", sizeof(icon_path));
icon_path[len ] = '.';
icon_path[len+1] = 'p';
icon_path[len+2] = 'n';
icon_path[len+3] = 'g';
icon_path[len+4] = '\0';
if (!path_is_valid(icon_path))
continue;

View File

@ -2451,7 +2451,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
strlcat(path_base, ".lpl", sizeof(path_base));
fill_pathname_join(path_playlist, dir_playlist, path_base,
fill_pathname_join_special(path_playlist, dir_playlist, path_base,
sizeof(path_playlist));
playlist_config_set_path(&playlist_config, path_playlist);
@ -3298,7 +3298,7 @@ static int menu_displaylist_parse_horizontal_list(
char path_playlist[PATH_MAX_LENGTH];
const char *dir_playlist = settings->paths.directory_playlist;
fill_pathname_join(path_playlist, dir_playlist, item->path,
fill_pathname_join_special(path_playlist, dir_playlist, item->path,
sizeof(path_playlist));
/* Horizontal lists are always 'collections'
@ -4312,7 +4312,7 @@ static unsigned menu_displaylist_parse_cores(
char display_name[PATH_MAX_LENGTH];
display_name[0] = '\0';
fill_pathname_join(core_path, dir, path, sizeof(core_path));
fill_pathname_join_special(core_path, dir, path, sizeof(core_path));
if (core_info_list_get_display_name(list,
core_path, display_name, sizeof(display_name)))
@ -4713,9 +4713,7 @@ static unsigned menu_displaylist_parse_content_information(
{
char db_path[PATH_MAX_LENGTH];
db_path[0] = '\0';
fill_pathname_join(db_path,
fill_pathname_join_special(db_path,
settings->paths.path_content_database,
db_name,
sizeof(db_path));
@ -11509,7 +11507,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
char combined_path[PATH_MAX_LENGTH];
const char *ext = NULL;
fill_pathname_join(combined_path, menu->scratch2_buf,
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
ext = path_get_extension(combined_path);
@ -11934,7 +11932,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
const char *
network_buildbot_assets_url = settings->paths.network_buildbot_assets_url;
fill_pathname_join(new_label,
fill_pathname_join_special(new_label,
network_buildbot_assets_url,
"cores", sizeof(new_label));
@ -12140,7 +12138,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
char path_playlist[PATH_MAX_LENGTH];
playlist_t *playlist = NULL;
const char *dir_playlist = settings->paths.directory_playlist;
fill_pathname_join(
fill_pathname_join_special(
path_playlist,
dir_playlist,
info->path,

View File

@ -3870,7 +3870,7 @@ bool menu_shader_manager_operate_auto_preset(
/* We are only including this directory for compatibility purposes with
* versions 1.8.7 and older. */
if (op != AUTO_SHADER_OP_SAVE && !string_is_empty(dir_video_shader))
fill_pathname_join(
fill_pathname_join_special(
old_presets_directory,
dir_video_shader,
"presets",
@ -3886,19 +3886,19 @@ bool menu_shader_manager_operate_auto_preset(
strcpy_literal(file, "global");
break;
case SHADER_PRESET_CORE:
fill_pathname_join(file, core_name, core_name, sizeof(file));
fill_pathname_join_special(file, core_name, core_name, sizeof(file));
break;
case SHADER_PRESET_PARENT:
fill_pathname_parent_dir_name(tmp,
rarch_path_basename, sizeof(tmp));
fill_pathname_join(file, core_name, tmp, sizeof(file));
fill_pathname_join_special(file, core_name, tmp, sizeof(file));
break;
case SHADER_PRESET_GAME:
{
const char *game_name = path_basename(rarch_path_basename);
if (string_is_empty(game_name))
return false;
fill_pathname_join(file, core_name, game_name, sizeof(file));
fill_pathname_join_special(file, core_name, game_name, sizeof(file));
break;
}
default:

View File

@ -483,7 +483,7 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
if (!fext || strcasecmp(fext, ".lpl"))
continue;
fill_pathname_join(playlist_config.path,
fill_pathname_join_special(playlist_config.path,
directory_playlist, fname, sizeof(playlist_config.path));
playlist_config.capacity = COLLECTION_SIZE;
playlist = playlist_init(&playlist_config);
@ -536,7 +536,7 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
memcpy(newrdb.systemname, db_name, systemname_len);
newrdb.systemname[systemname_len] = '\0';
fill_pathname_join(
fill_pathname_join_special(
tmp, directory_database, db_name, sizeof(tmp));
path_remove_extension(tmp);
strlcat(tmp, ".rdb", sizeof(tmp));

View File

@ -462,11 +462,11 @@ static bool menu_screensaver_update_state(
char pkg_path[PATH_MAX_LENGTH];
/* Get font file path */
if (!string_is_empty(dir_assets))
fill_pathname_join(pkg_path, dir_assets, MENU_SS_PKG_DIR, sizeof(pkg_path));
fill_pathname_join_special(pkg_path, dir_assets, MENU_SS_PKG_DIR, sizeof(pkg_path));
else
strlcpy(pkg_path, MENU_SS_PKG_DIR, sizeof(pkg_path));
fill_pathname_join(font_file, pkg_path, MENU_SS_FONT_FILE,
fill_pathname_join_special(font_file, pkg_path, MENU_SS_FONT_FILE,
sizeof(font_file));
/* Warn if font file is missing */

View File

@ -107,7 +107,7 @@ static bool discord_download_avatar(
fill_pathname_application_special(buf,
sizeof(buf),
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS);
fill_pathname_join(full_path, buf, avatar_id, sizeof(full_path));
fill_pathname_join_special(full_path, buf, avatar_id, sizeof(full_path));
strlcpy(discord_st->user_avatar,
avatar_id, sizeof(discord_st->user_avatar));

View File

@ -321,10 +321,10 @@ static bool connmanctl_connect_ssid(
void *data, const wifi_network_info_t *netinfo)
{
unsigned i;
bool success = false;
char settings_dir[PATH_MAX_LENGTH] = {0};
char settings_path[PATH_MAX_LENGTH] = {0};
char netid[160] = {0};
char netid[160];
char settings_dir[PATH_MAX_LENGTH];
char settings_path[PATH_MAX_LENGTH];
bool success = false;
connman_t *connman = (connman_t*)data;
settings_t *settings = config_get_ptr();
static struct string_list* list = NULL;
@ -333,12 +333,12 @@ static bool connmanctl_connect_ssid(
connman->connmanctl_widgets_supported;
#endif
strlcpy(netid, netinfo->netid, sizeof(netid));
fill_pathname_join(settings_dir, LAKKA_CONNMAN_DIR,
fill_pathname_join_special(settings_dir, LAKKA_CONNMAN_DIR,
netid, sizeof(settings_dir));
path_mkdir(settings_dir);
fill_pathname_join(settings_path, settings_dir, "settings",
fill_pathname_join_special(settings_path, settings_dir, "settings",
sizeof(settings_path));
if (!netinfo->saved_password)

View File

@ -260,27 +260,27 @@ bool recording_init(void)
{
fill_str_dated_filename(buf, game_name,
"mkv", sizeof(buf));
fill_pathname_join(output, recording_st->output_dir, buf, sizeof(output));
fill_pathname_join_special(output, recording_st->output_dir, buf, sizeof(output));
}
else if (video_record_quality >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST
&& video_record_quality < RECORD_CONFIG_TYPE_RECORDING_GIF)
{
fill_str_dated_filename(buf, game_name,
"webm", sizeof(buf));
fill_pathname_join(output, recording_st->output_dir, buf, sizeof(output));
fill_pathname_join_special(output, recording_st->output_dir, buf, sizeof(output));
}
else if (video_record_quality >= RECORD_CONFIG_TYPE_RECORDING_GIF
&& video_record_quality < RECORD_CONFIG_TYPE_RECORDING_APNG)
{
fill_str_dated_filename(buf, game_name,
"gif", sizeof(buf));
fill_pathname_join(output, recording_st->output_dir, buf, sizeof(output));
fill_pathname_join_special(output, recording_st->output_dir, buf, sizeof(output));
}
else
{
fill_str_dated_filename(buf, game_name,
"png", sizeof(buf));
fill_pathname_join(output, recording_st->output_dir, buf, sizeof(output));
fill_pathname_join_special(output, recording_st->output_dir, buf, sizeof(output));
}
}
}

View File

@ -745,7 +745,7 @@ void retroarch_path_set_redirect(settings_t *settings)
{
/* Append content directory name to save location */
if (sort_savefiles_by_content_enable)
fill_pathname_join(
fill_pathname_join_special(
new_savefile_dir,
old_savefile_dir,
content_dir_name,
@ -753,7 +753,7 @@ void retroarch_path_set_redirect(settings_t *settings)
/* Append library_name to the save location */
if (sort_savefiles_enable)
fill_pathname_join(
fill_pathname_join_special(
new_savefile_dir,
new_savefile_dir,
system->library_name,
@ -778,7 +778,7 @@ void retroarch_path_set_redirect(settings_t *settings)
{
/* Append content directory name to savestate location */
if (sort_savestates_by_content_enable)
fill_pathname_join(
fill_pathname_join_special(
new_savestate_dir,
old_savestate_dir,
content_dir_name,
@ -787,7 +787,7 @@ void retroarch_path_set_redirect(settings_t *settings)
/* Append library_name to the savestate location */
if (sort_savestates_enable)
{
fill_pathname_join(
fill_pathname_join_special(
new_savestate_dir,
new_savestate_dir,
system->library_name,
@ -843,7 +843,7 @@ void retroarch_path_set_redirect(settings_t *settings)
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
{
fill_pathname_join(new_savefile_dir, new_savefile_dir, ".netplay",
fill_pathname_join_special(new_savefile_dir, new_savefile_dir, ".netplay",
sizeof(new_savefile_dir));
if (!path_is_directory(new_savefile_dir) &&
@ -4379,7 +4379,7 @@ static void retroarch_parse_input_libretro_path(const char *path)
!string_is_equal(path_ext, core_ext))
goto end;
fill_pathname_join(tmp_path, settings->paths.directory_libretro,
fill_pathname_join_special(tmp_path, settings->paths.directory_libretro,
path, sizeof(tmp_path));
if (string_is_empty(tmp_path))
@ -4825,7 +4825,7 @@ static bool retroarch_parse_input_and_config(
strlcpy(video_st->cli_shader_path, optarg,
sizeof(video_st->cli_shader_path));
else
fill_pathname_join(video_st->cli_shader_path,
fill_pathname_join_special(video_st->cli_shader_path,
settings->paths.directory_video_shader,
optarg, sizeof(video_st->cli_shader_path));
#endif

View File

@ -1080,7 +1080,7 @@ static bool validate_per_core_options(char *s,
if (mkdir && !path_is_valid(s))
{
char new_path[PATH_MAX_LENGTH];
fill_pathname_join(new_path,
fill_pathname_join_special(new_path,
config_directory, core_name, sizeof(new_path));
if (!path_is_directory(new_path))
path_mkdir(new_path);
@ -3935,7 +3935,7 @@ static char *copy_core_to_temp_file(
if (!(tmpdir = get_tmpdir_alloc(dir_libretro)))
return NULL;
fill_pathname_join(tmp_path,
fill_pathname_join_special(tmp_path,
tmpdir, "retroarch_temp",
sizeof(tmp_path));

View File

@ -283,7 +283,7 @@ runtime_log_t *runtime_log_init(
* If 'custom' runtime log path is undefined,
* use default 'playlists/logs' directory... */
if (string_is_empty(dir_runtime_log))
fill_pathname_join(
fill_pathname_join_special(
tmp_buf,
dir_playlist,
"logs",
@ -295,7 +295,7 @@ runtime_log_t *runtime_log_init(
return NULL;
if (log_per_core)
fill_pathname_join(
fill_pathname_join_special(
log_file_dir,
tmp_buf,
core_name,
@ -363,7 +363,7 @@ runtime_log_t *runtime_log_init(
return NULL;
/* Build final log file path */
len = fill_pathname_join(log_file_path, log_file_dir,
len = fill_pathname_join_special(log_file_path, log_file_dir,
content_name, sizeof(log_file_path));
log_file_path[len ] = '.';
log_file_path[len+1] = 'l';

View File

@ -654,7 +654,8 @@ bool input_autoconfigure_connect(
{
char dir_driver_autoconfig[PATH_MAX_LENGTH];
/* Generate driver-specific autoconfig directory */
fill_pathname_join(dir_driver_autoconfig, dir_autoconfig,
fill_pathname_join_special(dir_driver_autoconfig,
dir_autoconfig,
autoconfig_handle->device_info.joypad_driver,
sizeof(dir_driver_autoconfig));

View File

@ -1064,7 +1064,7 @@ static bool content_file_load(
strlcpy(new_basedir, uwp_dir_data, sizeof(new_basedir));
}
}
fill_pathname_join(new_path, new_basedir,
fill_pathname_join_special(new_path, new_basedir,
path_basename(content_path), sizeof(new_path));
mbstowcs(wnew_path, new_path, MAX_PATH);

View File

@ -163,7 +163,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
strlcpy(cue_filename, state->title, sizeof(cue_filename));
strlcat(cue_filename, ".cue", sizeof(cue_filename));
fill_pathname_join(output_file,
fill_pathname_join_special(output_file,
directory_core_assets, cue_filename, sizeof(output_file));
{
@ -261,7 +261,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
state->cur_track_bytes = filestream_get_size(state->file);
fill_pathname_join(output_path,
fill_pathname_join_special(output_path,
directory_core_assets, track_filename, sizeof(output_path));
if (!(state->output_file = filestream_open(output_path, RETRO_VFS_FILE_ACCESS_WRITE, 0)))

View File

@ -314,7 +314,7 @@ static void task_core_updater_get_list_handler(retro_task_t *task)
if (string_is_empty(net_buildbot_url))
goto task_finished;
fill_pathname_join(
fill_pathname_join_special(
buildbot_url,
net_buildbot_url,
".index-extended",
@ -1042,7 +1042,7 @@ void *task_push_core_updater_download(
if (string_is_empty(path_dir_libretro))
goto error;
fill_pathname_join(
fill_pathname_join_special(
local_download_path,
path_dir_libretro,
list_entry->remote_filename,

View File

@ -753,7 +753,7 @@ static int database_info_list_iterate_found_match(
strlcat(db_playlist_base_str, ".lpl", str_len);
if (!string_is_empty(_db->playlist_directory))
fill_pathname_join(db_playlist_path, _db->playlist_directory,
fill_pathname_join_special(db_playlist_path, _db->playlist_directory,
db_playlist_base_str, str_len);
playlist_config_set_path(&_db->playlist_config, db_playlist_path);
@ -986,7 +986,7 @@ static int task_database_iterate_playlist_lutro(
db_playlist_path[0] = '\0';
if (!string_is_empty(_db->playlist_directory))
fill_pathname_join(db_playlist_path,
fill_pathname_join_special(db_playlist_path,
_db->playlist_directory,
"Lutro.lpl", sizeof(db_playlist_path));

View File

@ -1083,7 +1083,7 @@ int cue_find_track(const char *cue_path, bool first,
}
get_token(fd, tmp_token, sizeof(tmp_token));
fill_pathname_join(last_file, cue_dir,
fill_pathname_join_special(last_file, cue_dir,
tmp_token, sizeof(last_file));
file_size = intfstream_get_file_size(last_file);
@ -1175,7 +1175,8 @@ bool cue_next_file(intfstream_t *fd,
if (string_is_equal_noncase(tmp_token, "FILE"))
{
get_token(fd, tmp_token, sizeof(tmp_token));
fill_pathname_join(path, cue_dir, tmp_token, (size_t)max_len);
fill_pathname_join_special(path, cue_dir,
tmp_token, (size_t)max_len);
rv = true;
break;
}
@ -1265,15 +1266,11 @@ int gdi_find_track(const char *gdi_path, bool first,
char last_file[PATH_MAX_LENGTH];
char gdi_dir[PATH_MAX_LENGTH];
gdi_dir[0] = last_file[0] = '\0';
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join(last_file,
fill_pathname_join_special(last_file,
gdi_dir, tmp_token, sizeof(last_file));
file_size = intfstream_get_file_size(last_file);
if (file_size < 0)
if ((file_size = intfstream_get_file_size(last_file)) < 0)
goto error;
if ((uint64_t)file_size > largest)
@ -1332,11 +1329,8 @@ bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
{
char gdi_dir[PATH_MAX_LENGTH];
gdi_dir[0] = '\0';
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join(path, gdi_dir, tmp_token, (size_t)max_len);
fill_pathname_join_special(path, gdi_dir, tmp_token, (size_t)max_len);
rv = true;

View File

@ -55,7 +55,7 @@ static int file_decompressed_subdir(const char *name,
name += strlen(userdata->dec->subdir) + 1;
fill_pathname_join(path,
fill_pathname_join_special(path,
userdata->dec->target_dir, name, sizeof(path));
fill_pathname_basedir(path_dir, path, sizeof(path_dir));
@ -89,13 +89,13 @@ static int file_decompressed(const char *name, const char *valid_exts,
if (last_char == '/' || last_char == '\\')
return 1;
/* Make directory */
fill_pathname_join(path, dec->target_dir, name, sizeof(path));
fill_pathname_join_special(path, dec->target_dir, name, sizeof(path));
path_basedir_wrapper(path);
if (!path_mkdir(path))
goto error;
fill_pathname_join(path, dec->target_dir, name, sizeof(path));
fill_pathname_join_special(path, dec->target_dir, name, sizeof(path));
if (!file_archive_perform_mode(path, valid_exts,
cdata, cmode, csize, size, crc32, userdata))

View File

@ -141,10 +141,10 @@ static bool get_thumbnail_paths(
system_name = db_name;
/* Generate local path */
fill_pathname_join(path, pl_thumb->dir_thumbnails,
fill_pathname_join_special(path, pl_thumb->dir_thumbnails,
system_name, path_size);
fill_pathname_join(tmp_buf, path, sub_dir, sizeof(tmp_buf));
fill_pathname_join(path, tmp_buf, img_name, path_size);
fill_pathname_join_special(tmp_buf, path, sub_dir, sizeof(tmp_buf));
fill_pathname_join_special(path, tmp_buf, img_name, path_size);
if (string_is_empty(path))
return false;

View File

@ -288,7 +288,7 @@ static bool screenshot_dump(
char content_dir_name[PATH_MAX_LENGTH];
fill_pathname_parent_dir_name(content_dir_name,
content_dir, sizeof(content_dir_name));
fill_pathname_join(
fill_pathname_join_special(
new_screenshot_dir,
screenshot_dir,
content_dir_name,
@ -339,7 +339,7 @@ static bool screenshot_dump(
fill_pathname_basedir(new_screenshot_dir, name_base,
sizeof(new_screenshot_dir));
fill_pathname_join(state->filename, new_screenshot_dir,
fill_pathname_join_special(state->filename, new_screenshot_dir,
state->shotname, sizeof(state->filename));
/* Create screenshot directory, if required */

View File

@ -1424,10 +1424,9 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
return corePath;
/* Get playlist path */
len = fill_pathname_join(
playlistPath,
settings->paths.directory_playlist, plNameCString,
sizeof(playlistPath));
len = fill_pathname_join_special(
playlistPath, settings->paths.directory_playlist,
plNameCString, sizeof(playlistPath));
playlistPath[len ] = '.';
playlistPath[len+1] = 'l';
playlistPath[len+2] = 'p';

View File

@ -438,7 +438,6 @@ void rarch_log_file_init(
static char timestamped_log_file_name[64] = {0};
bool logging_to_file = g_verbosity->initialized;
log_file_path[0] = '\0';
/* If this is the first run, generate a timestamped log
* file name (do this even when not outputting timestamped
@ -503,13 +502,15 @@ void rarch_log_file_init(
strlcpy(log_directory, log_dir, sizeof(log_directory));
/* Get log file path */
fill_pathname_join(log_file_path,
fill_pathname_join_special(log_file_path,
log_dir,
log_to_file_timestamp
? timestamped_log_file_name
: "retroarch.log",
sizeof(log_file_path));
}
else
log_file_path[0] = '\0';
/* > Attempt to initialise log file */
if (!string_is_empty(log_file_path))