History

TOOLS/lua/autoload: add ignore_hidden option

In 8a7614a0fb0d4f1073057049933972bb1113c14c files that start with a '.' were blacklisted from autoload.lua. Since then 35e8710b86545849484f6544a16047792fa75bb2 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.

LaserEyess committed 5 years ago

Commit 28c53db1 parent 5e23e811 file · +4 −2Browse files

Unified · Split

TOOLS/lua/autoload.lua+4−2
@@ -16,6 +16,7 @@ disabled=no · 15 unmodified lines
16images=no16images=no
17videos=yes17videos=yes
18audio=yes18audio=yes
19ignore_hidden=yes
19 20
20--]]21--]]
21 22
@@ -29,7 +30,8 @@ o = { · 7 unmodified lines
29 disabled = false,30 disabled = false,
30 images = true,31 images = true,
31 videos = true,32 videos = true,
32 audio = true33 audio = true,
34 ignore_hidden = true
33}35}
34options.read_options(o)36options.read_options(o)
35 37
@@ -155,7 +157,7 @@ function find_and_add_entries() · 119 unmodified lines
155 return157 return
156 end158 end
157 table.filter(files, function (v, k)159 table.filter(files, function (v, k)
158 if string.match(v, "^%.") then160 if (o.ignore_hidden and string.match(v, "^%.")) then
159 return false161 return false
160 end162 end
161 local ext = get_extension(v)163 local ext = get_extension(v)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t