feat: convert oil://path/to/file.lua to normal file path (#77)
This commit is contained in:
parent
d48fa09c82
commit
d7805c7751
3 changed files with 46 additions and 1 deletions
|
|
@ -180,7 +180,17 @@ M.normalize_url = function(url, callback)
|
|||
vim.loop.fs_stat(
|
||||
realpath,
|
||||
vim.schedule_wrap(function(stat_err, stat)
|
||||
if not stat or stat.type == "directory" then
|
||||
local is_directory
|
||||
if stat then
|
||||
is_directory = stat.type == "directory"
|
||||
elseif vim.endswith(realpath, "/") then
|
||||
is_directory = true
|
||||
else
|
||||
local filetype = vim.filetype.match({ filename = vim.fs.basename(realpath) })
|
||||
is_directory = filetype == nil
|
||||
end
|
||||
|
||||
if is_directory then
|
||||
local norm_path = util.addslash(fs.os_to_posix_path(realpath))
|
||||
callback(scheme .. norm_path)
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue