Fix dirmonitor sorting issues (#1599)
* Use `PATHSEP` in path-related functions * Don't stop on digits when getting the common part in `system.path_compare` * Avoid sorting multiple times in `dirwatch.get_directory_files` This also fixes the timeout detection in `recurse_pred`.
This commit is contained in:
+4
-6
@@ -102,7 +102,7 @@ local function strip_leading_path(filename)
|
||||
end
|
||||
|
||||
local function strip_trailing_slash(filename)
|
||||
if filename:match("[^:][/\\]$") then
|
||||
if filename:match("[^:]["..PATHSEP.."]$") then
|
||||
return filename:sub(1, -2)
|
||||
end
|
||||
return filename
|
||||
@@ -120,9 +120,7 @@ local function show_max_files_warning(dir)
|
||||
"Too many files in project directory: stopped reading at "..
|
||||
config.max_project_files.." files. For more information see "..
|
||||
"usage.md at https://github.com/lite-xl/lite-xl."
|
||||
if core.status_view then
|
||||
core.status_view:show_message("!", style.accent, message)
|
||||
end
|
||||
core.warn(message)
|
||||
end
|
||||
|
||||
|
||||
@@ -184,7 +182,7 @@ local function refresh_directory(topdir, target)
|
||||
directory_start_idx = directory_start_idx + 1
|
||||
end
|
||||
|
||||
local files = dirwatch.get_directory_files(topdir, topdir.name, (target or ""), {}, 0, function() return false end)
|
||||
local files = dirwatch.get_directory_files(topdir, topdir.name, (target or ""), 0, function() return false end)
|
||||
local change = false
|
||||
|
||||
-- If this file doesn't exist, we should be calling this on our parent directory, assume we'll do that.
|
||||
@@ -265,7 +263,7 @@ function core.add_project_directory(path)
|
||||
|
||||
local fstype = PLATFORM == "Linux" and system.get_fs_type(topdir.name) or "unknown"
|
||||
topdir.force_scans = (fstype == "nfs" or fstype == "fuse")
|
||||
local t, complete, entries_count = dirwatch.get_directory_files(topdir, topdir.name, "", {}, 0, timed_max_files_pred)
|
||||
local t, complete, entries_count = dirwatch.get_directory_files(topdir, topdir.name, "", 0, timed_max_files_pred)
|
||||
topdir.files = t
|
||||
if not complete then
|
||||
topdir.slow_filesystem = not complete and (entries_count <= config.max_project_files)
|
||||
|
||||
Reference in New Issue
Block a user