summaryrefslogtreecommitdiffstats
path: root/options/path.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-10-20 18:18:16 +0600
committersfan5 <sfan5@live.de>2023-10-22 10:41:19 +0200
commitcf7453226d089b2db8c02cf95b23cf648299617b (patch)
treeaea19606c73a3dfb85c23ca806eb340f6f4bec9e /options/path.c
parent6e428c261e1d005832ec969807d0a5a094862974 (diff)
downloadmpv-cf7453226d089b2db8c02cf95b23cf648299617b.tar.bz2
mpv-cf7453226d089b2db8c02cf95b23cf648299617b.tar.xz
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.
Diffstat (limited to 'options/path.c')
-rw-r--r--options/path.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/options/path.c b/options/path.c
index 581874b94b..52dc113b73 100644
--- a/options/path.c
+++ b/options/path.c
@@ -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)