Undo path_basedir_size

This commit is contained in:
twinaphex 2020-08-04 03:05:20 +02:00
parent 14647915a1
commit 3680804217
6 changed files with 9 additions and 48 deletions

View File

@ -313,7 +313,7 @@ bool disk_index_file_init(
{
/* Use content directory */
strlcpy(disk_index_file_dir, content_path, sizeof(disk_index_file_dir));
path_basedir_size(disk_index_file_dir, STRLEN_CONST(disk_index_file_dir));
path_basedir(disk_index_file_dir);
}
/* > Create directory, if required */

View File

@ -403,7 +403,7 @@ void fill_pathname_basedir(char *out_dir,
{
if (out_dir != in_path)
strlcpy(out_dir, in_path, size);
path_basedir_size(out_dir, size);
path_basedir(out_dir);
}
void fill_pathname_basedir_noext(char *out_dir,
@ -554,32 +554,6 @@ void path_basedir(char *path)
snprintf(path, 3, "." PATH_DEFAULT_SLASH());
}
/**
* path_basedir_size:
* @path : path
* @size : size of path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
*
* Specialized function that avoids the implicit
* strlen call
**/
void path_basedir_size(char *path, size_t size)
{
char *last = NULL;
if (size < 2)
return;
last = find_last_slash(path);
if (last)
last[1] = '\0';
else
snprintf(path, 3, "." PATH_DEFAULT_SLASH());
}
/**
* path_parent_dir:
* @path : path

View File

@ -497,7 +497,7 @@ bool m3u_file_save(
if (find_last_slash(m3u_file->path))
{
strlcpy(base_dir, m3u_file->path, sizeof(base_dir));
path_basedir_size(base_dir, STRLEN_CONST(base_dir));
path_basedir(base_dir);
}
/* Open file for writing */

View File

@ -135,19 +135,6 @@ const char *path_basename(const char *path);
**/
void path_basedir(char *path);
/**
* path_basedir_size:
* @path : path
* @size : size of path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
*
* Specialized function that avoids the implicit
* strlen call
**/
void path_basedir_size(char *path, size_t size);
/**
* path_parent_dir:
* @path : path

View File

@ -898,7 +898,7 @@ int generic_action_ok_displaylist_push(const char *path,
{
filebrowser_clear_type();
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
path_basedir_size(tmp, STRLEN_CONST(tmp));
path_basedir(tmp);
info.type = type;
info.directory_ptr = idx;
@ -914,7 +914,7 @@ int generic_action_ok_displaylist_push(const char *path,
strlcpy(tmp, content_get_subsystem_rom(content_get_subsystem_rom_id() - 1), sizeof(tmp));
else
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
path_basedir_size(tmp, STRLEN_CONST(tmp));
path_basedir(tmp);
if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD)
content_clear_subsystem();

View File

@ -8081,7 +8081,7 @@ static bool menu_shader_manager_save_preset_internal(
fullname, sizeof(buffer));
strlcpy(basedir, buffer, sizeof(basedir));
path_basedir_size(basedir, STRLEN_CONST(basedir));
path_basedir(basedir);
if (!path_is_directory(basedir))
{
@ -8991,7 +8991,7 @@ static void discord_init(
strlcpy(command, args, sizeof(command));
else
{
path_basedir_size(full_path, STRLEN_CONST(full_path));
path_basedir(full_path);
snprintf(command, sizeof(command), "%s%s", full_path, args);
}
#else
@ -11057,7 +11057,7 @@ static void path_set_redirect(struct rarch_state *p_rarch)
{
strlcpy(new_savefile_dir, p_rarch->path_main_basename,
path_size);
path_basedir_size(new_savefile_dir, STRLEN_CONST(new_savefile_dir));
path_basedir(new_savefile_dir);
}
/* Set savestate directory if empty based on content directory */
@ -11065,7 +11065,7 @@ static void path_set_redirect(struct rarch_state *p_rarch)
{
strlcpy(new_savestate_dir, p_rarch->path_main_basename,
path_size);
path_basedir_size(new_savestate_dir, STRLEN_CONST(new_savestate_dir));
path_basedir(new_savestate_dir);
}
if (global)