mirror of
https://github.com/libretro/RetroArch
synced 2025-02-05 06:40:07 +00:00
Add fill_pathname_base.
This commit is contained in:
parent
93068a376a
commit
accb011196
15
file.c
15
file.c
@ -1008,3 +1008,18 @@ void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replac
|
||||
ssnes_assert(strlcat(in_dir, base, size) < size);
|
||||
ssnes_assert(strlcat(in_dir, replace, size) < size);
|
||||
}
|
||||
|
||||
void fill_pathname_base(char *out_dir, const char *in_path, size_t size)
|
||||
{
|
||||
const char *ptr = strrchr(in_path, '/');
|
||||
if (!ptr)
|
||||
ptr = strrchr(in_path, '\\');
|
||||
|
||||
if (ptr)
|
||||
ptr++;
|
||||
else
|
||||
ptr = in_path;
|
||||
|
||||
ssnes_assert(strlcpy(out_dir, ptr, size) < size);
|
||||
}
|
||||
|
||||
|
3
file.h
3
file.h
@ -71,4 +71,7 @@ void fill_pathname_noext(char *out_path, const char *in_path, const char *replac
|
||||
// in_dir = "/tmp/some_dir/foo.c.asm"
|
||||
void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replace, size_t size);
|
||||
|
||||
// Copies basename of in_path into out_path.
|
||||
void fill_pathname_base(char *out_path, const char *in_path, size_t size);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user