mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
add fill_pathname_parent_dir_name function
This commit is contained in:
parent
34a1eb34a9
commit
722137296d
2 changed files with 34 additions and 0 deletions
|
@ -594,6 +594,28 @@ void fill_pathname_basedir_noext(char *out_dir,
|
|||
path_remove_extension(out_dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_pathname_parent_dir_name:
|
||||
* @out_dir : output directory
|
||||
* @in_dir : input directory
|
||||
* @size : size of output directory
|
||||
*
|
||||
* Copies only the parent directory name of @in_dir into @out_dir.
|
||||
* The two buffers must not overlap. Removes trailing '/'.
|
||||
**/
|
||||
void fill_pathname_parent_dir_name(char *out_dir,
|
||||
const char *in_dir, size_t size)
|
||||
{
|
||||
char *temp = strdup(in_dir);
|
||||
char *last = find_last_slash(temp);
|
||||
|
||||
*last = '\0';
|
||||
|
||||
in_dir = find_last_slash(temp) + 1;
|
||||
|
||||
strlcpy(out_dir, in_dir, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_pathname_parent_dir:
|
||||
* @out_dir : output directory
|
||||
|
|
|
@ -290,6 +290,18 @@ void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
|
|||
void fill_pathname_basedir_noext(char *out_dir,
|
||||
const char *in_path, size_t size);
|
||||
|
||||
/**
|
||||
* fill_pathname_parent_dir_name:
|
||||
* @out_dir : output directory
|
||||
* @in_dir : input directory
|
||||
* @size : size of output directory
|
||||
*
|
||||
* Copies only the parent directory name of @in_dir into @out_dir.
|
||||
* The two buffers must not overlap. Removes trailing '/'.
|
||||
**/
|
||||
void fill_pathname_parent_dir_name(char *out_dir,
|
||||
const char *in_dir, size_t size);
|
||||
|
||||
/**
|
||||
* fill_pathname_parent_dir:
|
||||
* @out_dir : output directory
|
||||
|
|
Loading…
Add table
Reference in a new issue