@@ -1123,17 +1123,13 @@ M.split_path = function(path)
11231123 if path == M .path_separator then
11241124 return nil , M .path_separator
11251125 end
1126- local parts = M .split (path , M .path_separator )
1126+ local parts = vim .split (path , M .path_separator , { plain = true } )
11271127 local name = table.remove (parts )
1128+ --- @type string ?
11281129 local parentPath = table.concat (parts , M .path_separator )
1129- if M .is_windows then
1130- if # parts == 1 then
1131- parentPath = parentPath .. M .path_separator
1132- elseif parentPath == " " then
1133- return M .abspath_prefix (path ), name
1134- end
1135- else
1136- parentPath = M .path_separator .. parentPath
1130+ local prefix = M .abspath_prefix (path )
1131+ if # parentPath == 0 and prefix then
1132+ parentPath = prefix
11371133 end
11381134 return parentPath , name
11391135end
@@ -1260,7 +1256,7 @@ end
12601256---
12611257--- For Windows systems, this function handles punctuation characters that will
12621258--- be escaped, but may appear at the beginning of a path segment. For example,
1263- --- the path `C:\foo\(bar) \baz.txt` (where foo, (bar), and baz.txt are segments)
1259+ --- the path `C:\foo\(bar\baz.txt` (where foo, (bar), and baz.txt are segments)
12641260--- will remain unchanged when escaped by `fnaemescape` on a Windows system.
12651261--- However, if that strig is used to edit a file with `:e`, `:b`, etc., the open
12661262--- parenthesis will be treated as an escaped character and the path separator will
0 commit comments