diff options
| author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-12-30 22:24:43 +0100 |
|---|---|---|
| committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-12-30 22:24:43 +0100 |
| commit | 68aea8851014206654f1195dc0e50799718110e3 (patch) | |
| tree | 0077c41ae4eac140b57489b6c8d62ae4cccc84f3 | |
| parent | 9578359b2b2f0402b840c86f33a9bba13593c586 (diff) | |
| download | lite-xl-68aea8851014206654f1195dc0e50799718110e3.tar.gz lite-xl-68aea8851014206654f1195dc0e50799718110e3.zip | |
Fix error with ignore_files
There was a double error because the config.ignore_files was
used at two differect places in different ways.
Now we apply coherently the original rule to apply
config.ignore_files to the basename of each file or directory.
| -rw-r--r-- | data/core/init.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/data/core/init.lua b/data/core/init.lua index 803f1946..24083f0a 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -111,15 +111,20 @@ local function compare_file(a, b) end +local function fileinfo_pass_filter(info) + local basename = common.basename(info.filename) + return (info.size < config.file_size_limit * 1e6 and + not common.match_pattern(basename, config.ignore_files)) +end + + -- compute a file's info entry completed with "filename" to be used -- in project scan or falsy if it shouldn't appear in the list. local function get_project_file_info(root, file) local info = system.get_file_info(root .. file) if info then info.filename = strip_leading_path(file) - return (info.size < config.file_size_limit * 1e6 and - not common.match_pattern(info.filename, config.ignore_files) - and info) + return fileinfo_pass_filter(info) and info end end @@ -564,12 +569,8 @@ end local function project_scan_add_file(dir, filepath) - for fragment in string.gmatch(filepath, "([^/\\]+)") do - if common.match_pattern(fragment, config.ignore_files) then - return - end - end local fileinfo = get_project_file_info(dir.name, PATHSEP .. filepath) + if not fileinfo_pass_filter(fileinfo) then return end if fileinfo then project_scan_add_entry(dir, fileinfo) end |
