Merge branch 'master' of github.com:Themaister/SSNES

This commit is contained in:
TwinAphex51224 2012-01-31 12:14:00 +01:00
commit 56a1877d15
2 changed files with 18 additions and 0 deletions

15
file.c
View File

@ -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
View File

@ -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