mirror of https://github.com/mpv-player/mpv
path: don't treat "hidden" files as extension
currently for a filename such as ".file" mpv incorrectly thinks of the entire filename as being an extension. skip leading dots to avoid treating "hidden/dot" files as extension.
This commit is contained in:
parent
6e428c261e
commit
cf7453226d
|
@ -263,7 +263,8 @@ void mp_path_strip_trailing_separator(char *path)
|
||||||
char *mp_splitext(const char *path, bstr *root)
|
char *mp_splitext(const char *path, bstr *root)
|
||||||
{
|
{
|
||||||
assert(path);
|
assert(path);
|
||||||
const char *split = strrchr(path, '.');
|
int skip = (*path == '.'); // skip leading dot for "hidden" unix files
|
||||||
|
const char *split = strrchr(path + skip, '.');
|
||||||
if (!split || !split[1] || strchr(split, '/'))
|
if (!split || !split[1] || strchr(split, '/'))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (root)
|
if (root)
|
||||||
|
|
Loading…
Reference in New Issue