From 4c186b07a33f0cdabc22690ffc36cabb961b32a1 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 17 Aug 2022 00:11:19 +0200 Subject: [PATCH] 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\` --- data/core/common.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/core/common.lua b/data/core/common.lua index 5406f170..a4ea01f5 100644 --- a/data/core/common.lua +++ b/data/core/common.lua @@ -164,7 +164,9 @@ function common.path_suggest(text, root) 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 end local files = system.list_dir(path) or {}