fix: allow calling oil.open() with a url
This commit is contained in:
parent
3ac035e5ac
commit
be695dc350
1 changed files with 5 additions and 0 deletions
|
|
@ -166,7 +166,12 @@ end
|
||||||
M.get_url_for_path = function(dir)
|
M.get_url_for_path = function(dir)
|
||||||
local config = require("oil.config")
|
local config = require("oil.config")
|
||||||
local fs = require("oil.fs")
|
local fs = require("oil.fs")
|
||||||
|
local util = require("oil.util")
|
||||||
if dir then
|
if dir then
|
||||||
|
local scheme = util.parse_url(dir)
|
||||||
|
if scheme then
|
||||||
|
return dir
|
||||||
|
end
|
||||||
local abspath = vim.fn.fnamemodify(dir, ":p")
|
local abspath = vim.fn.fnamemodify(dir, ":p")
|
||||||
local path = fs.os_to_posix_path(abspath)
|
local path = fs.os_to_posix_path(abspath)
|
||||||
return config.adapter_to_scheme.files .. path
|
return config.adapter_to_scheme.files .. path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue