diff --git a/src/emu/path.c b/src/emu/path.c index a53362e..04719aa 100644 --- a/src/emu/path.c +++ b/src/emu/path.c @@ -100,3 +100,15 @@ path_remove_trailing(char *path) path[i] = '\0'; } } + +const char * +path_filename(const char *path) +{ + const char *start = strrchr(path, '/'); + if (start == NULL) + start = path; + else + start++; + + return start; +} diff --git a/src/emu/path.h b/src/emu/path.h index 7eb863d..486542e 100644 --- a/src/emu/path.h +++ b/src/emu/path.h @@ -10,5 +10,6 @@ int path_next(const char *path, char sep, const char (**next)); int path_keep(char *path, int n); int path_strip(const char *path, int n, const char (**next)); void path_remove_trailing(char *path); +const char *path_filename(const char *path); #endif /* PATH_H */