fix(windows): file operation preview uses only backslash path separator (#336)
This commit is contained in:
parent
be0a1ecbf0
commit
96f0983e75
2 changed files with 10 additions and 4 deletions
|
|
@ -40,7 +40,7 @@ end
|
|||
M.to_short_os_path = function(path, entry_type)
|
||||
local shortpath = fs.shorten_path(fs.posix_to_os_path(path))
|
||||
if entry_type == "directory" then
|
||||
shortpath = util.addslash(shortpath)
|
||||
shortpath = util.addslash(shortpath, true)
|
||||
end
|
||||
return shortpath
|
||||
end
|
||||
|
|
|
|||
|
|
@ -337,10 +337,16 @@ M.set_highlights = function(bufnr, highlights)
|
|||
end
|
||||
|
||||
---@param path string
|
||||
---@param os_slash? boolean use os filesystem slash instead of posix slash
|
||||
---@return string
|
||||
M.addslash = function(path)
|
||||
if not vim.endswith(path, "/") then
|
||||
return path .. "/"
|
||||
M.addslash = function(path, os_slash)
|
||||
local slash = "/"
|
||||
if os_slash and require("oil.fs").is_windows then
|
||||
slash = "\\"
|
||||
end
|
||||
|
||||
if not vim.endswith(path, slash) then
|
||||
return path .. slash
|
||||
else
|
||||
return path
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue