mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
fix sys_file_extension for folders that start with dot
This commit is contained in:
parent
585c24a282
commit
ef5eab2263
1 changed files with 4 additions and 1 deletions
|
@ -51,7 +51,10 @@ int sys_strcasecmp(const char *s1, const char *s2) {
|
|||
|
||||
const char *sys_file_extension(const char *fname) {
|
||||
const char *dot = strrchr(fname, '.');
|
||||
if (!dot || !dot[1]) return NULL;
|
||||
const char *sep = strrchr(fname, '/');
|
||||
if (!sep) sep = strrchr(fname, '\\');
|
||||
if (!dot || !dot[1]) return NULL; // no dot
|
||||
if (dot <= sep + 1) return NULL; // dot is before the last separator or right after it (e.g. /.local)
|
||||
return dot + 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue