Be more lenient with appending PATHSEP in common.path_suggest in Windows

This allows to use the Unix separator without resulting in ugly 
suggestions that added the Windows separator too.

For example:
Before: `data/` -> `data/\core\`
After: `data/` -> `data/core\`
This commit is contained in:
Guldoman
2022-08-17 00:11:19 +02:00
parent e8ca861512
commit 4c186b07a3
+3 -1
View File
@@ -164,7 +164,9 @@ function common.path_suggest(text, root)
end end
end end
if path:sub(-1) ~= PATHSEP then -- Only in Windows allow using both styles of PATHSEP
if (PATHSEP == "\\" and not string.match(path:sub(-1), "[\\/]")) or
(PATHSEP ~= "\\" and path:sub(-1) ~= PATHSEP) then
path = path .. PATHSEP path = path .. PATHSEP
end end
local files = system.list_dir(path) or {} local files = system.list_dir(path) or {}