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:
NRK 2023-10-20 18:18:16 +06:00 committed by sfan5
parent 6e428c261e
commit cf7453226d
1 changed files with 2 additions and 1 deletions

View File

@ -263,7 +263,8 @@ void mp_path_strip_trailing_separator(char *path)
char *mp_splitext(const char *path, bstr *root)
{
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, '/'))
return NULL;
if (root)