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:
Guldoman
2023-11-30 09:20:34 +08:00
committed by takase1121
parent 6cd1f96234
commit 5c5c77219b
5 changed files with 37 additions and 42 deletions
+1 -2
View File
@@ -1043,7 +1043,7 @@ static int f_load_native_plugin(lua_State *L) {
#endif
/* Special purpose filepath compare function. Corresponds to the
order used in the TreeView view of the project's files. Returns true iff
order used in the TreeView view of the project's files. Returns true if
path1 < path2 in the TreeView order. */
static int f_path_compare(lua_State *L) {
size_t len1, len2;
@@ -1057,7 +1057,6 @@ static int f_path_compare(lua_State *L) {
size_t offset = 0, i, j;
for (i = 0; i < len1 && i < len2; i++) {
if (path1[i] != path2[i]) break;
if (isdigit(path1[i])) break;
if (path1[i] == PATHSEP) {
offset = i + 1;
}