mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Undo path_basedir_size
This commit is contained in:
parent
14647915a1
commit
3680804217
@ -313,7 +313,7 @@ bool disk_index_file_init(
|
|||||||
{
|
{
|
||||||
/* Use content directory */
|
/* Use content directory */
|
||||||
strlcpy(disk_index_file_dir, content_path, sizeof(disk_index_file_dir));
|
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 */
|
/* > Create directory, if required */
|
||||||
|
@ -403,7 +403,7 @@ void fill_pathname_basedir(char *out_dir,
|
|||||||
{
|
{
|
||||||
if (out_dir != in_path)
|
if (out_dir != in_path)
|
||||||
strlcpy(out_dir, in_path, size);
|
strlcpy(out_dir, in_path, size);
|
||||||
path_basedir_size(out_dir, size);
|
path_basedir(out_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_pathname_basedir_noext(char *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());
|
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_parent_dir:
|
||||||
* @path : path
|
* @path : path
|
||||||
|
@ -497,7 +497,7 @@ bool m3u_file_save(
|
|||||||
if (find_last_slash(m3u_file->path))
|
if (find_last_slash(m3u_file->path))
|
||||||
{
|
{
|
||||||
strlcpy(base_dir, m3u_file->path, sizeof(base_dir));
|
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 */
|
/* Open file for writing */
|
||||||
|
@ -135,19 +135,6 @@ const char *path_basename(const char *path);
|
|||||||
**/
|
**/
|
||||||
void path_basedir(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_parent_dir:
|
||||||
* @path : path
|
* @path : path
|
||||||
|
@ -898,7 +898,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
|||||||
{
|
{
|
||||||
filebrowser_clear_type();
|
filebrowser_clear_type();
|
||||||
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
|
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
|
||||||
path_basedir_size(tmp, STRLEN_CONST(tmp));
|
path_basedir(tmp);
|
||||||
|
|
||||||
info.type = type;
|
info.type = type;
|
||||||
info.directory_ptr = idx;
|
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));
|
strlcpy(tmp, content_get_subsystem_rom(content_get_subsystem_rom_id() - 1), sizeof(tmp));
|
||||||
else
|
else
|
||||||
strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp));
|
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)
|
if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD)
|
||||||
content_clear_subsystem();
|
content_clear_subsystem();
|
||||||
|
@ -8081,7 +8081,7 @@ static bool menu_shader_manager_save_preset_internal(
|
|||||||
fullname, sizeof(buffer));
|
fullname, sizeof(buffer));
|
||||||
|
|
||||||
strlcpy(basedir, buffer, sizeof(basedir));
|
strlcpy(basedir, buffer, sizeof(basedir));
|
||||||
path_basedir_size(basedir, STRLEN_CONST(basedir));
|
path_basedir(basedir);
|
||||||
|
|
||||||
if (!path_is_directory(basedir))
|
if (!path_is_directory(basedir))
|
||||||
{
|
{
|
||||||
@ -8991,7 +8991,7 @@ static void discord_init(
|
|||||||
strlcpy(command, args, sizeof(command));
|
strlcpy(command, args, sizeof(command));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path_basedir_size(full_path, STRLEN_CONST(full_path));
|
path_basedir(full_path);
|
||||||
snprintf(command, sizeof(command), "%s%s", full_path, args);
|
snprintf(command, sizeof(command), "%s%s", full_path, args);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -11057,7 +11057,7 @@ static void path_set_redirect(struct rarch_state *p_rarch)
|
|||||||
{
|
{
|
||||||
strlcpy(new_savefile_dir, p_rarch->path_main_basename,
|
strlcpy(new_savefile_dir, p_rarch->path_main_basename,
|
||||||
path_size);
|
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 */
|
/* 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,
|
strlcpy(new_savestate_dir, p_rarch->path_main_basename,
|
||||||
path_size);
|
path_size);
|
||||||
path_basedir_size(new_savestate_dir, STRLEN_CONST(new_savestate_dir));
|
path_basedir(new_savestate_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global)
|
if (global)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user