TOOLS/lua/autoload: add ignore_hidden option

In 8a7614a0fb files that start with a '.'
were blacklisted from autoload.lua. Since then
35e8710b86 was introduced and explicitly
whitelisted file extensions. With this change, there is no longer a
reason to blacklist all files starting with '.', because it is valid to
have a file called '.hidden.mkv', and there is no chance of hidden files
such as '.bashrc', '.DS_STORE', '.gitignore', etc. being autoloaded by
mpv.

This commit tries to keep the same behavior as before, which is to by
default not load hidden files, but allows the user to optionally allow
hidden files to be autoloaded.
This commit is contained in:
LaserEyess authored and Dudemanguy committed 2021-06-24 13:13:53 +00:00
1 parent 5e23e81485
commit 28c53dbfa0
1 file changed
+4 -2
+4 -2
View File
@@ -16,6 +16,7 @@ disabled=no
images=no
videos=yes
audio=yes
ignore_hidden=yes
--]]
@@ -29,7 +30,8 @@ o = {
disabled = false,
images = true,
videos = true,
audio = true
audio = true,
ignore_hidden = true
}
options.read_options(o)
@@ -155,7 +157,7 @@ function find_and_add_entries()
return
end
table.filter(files, function (v, k)
if string.match(v, "^%.") then
if (o.ignore_hidden and string.match(v, "^%.")) then
return false
end
local ext = get_extension(v)