fix: only allow backslash as path separator in Windows in common.path_suggest (#1976)

This commit is contained in:
Guldoman
2024-12-04 13:02:07 +08:00
committed by takase1121
parent ad628da44d
commit f87617f829
+6 -1
View File
@@ -226,7 +226,12 @@ function common.path_suggest(text, root)
if root and root:sub(-1) ~= PATHSEP then
root = root .. PATHSEP
end
local path, name = text:match("^(.-)([^"..PATHSEP.."/]*)$")
local pathsep = PATHSEP
if PLATFORM == "Windows" then
pathsep = "\\/"
end
local path = text:match("^(.-)[^"..pathsep.."]*$")
local clean_dotslash = false
-- ignore root if path is absolute
local is_absolute = common.is_absolute_path(text)