mirror of https://github.com/LazyVim/starter
add path join
parent
31944b41ea
commit
c0a4f96d56
|
@ -54,7 +54,7 @@ end
|
||||||
|
|
||||||
local function get_ssh_hosts(path)
|
local function get_ssh_hosts(path)
|
||||||
local hosts = {}
|
local hosts = {}
|
||||||
path = path or utils.os.home() .. "/.ssh/config"
|
path = path or utils.os.path.join({ utils.os.home(), ".ssh", "config" })
|
||||||
|
|
||||||
if type(path) ~= "string" then
|
if type(path) ~= "string" then
|
||||||
print("expected arg path of type 'string' actual '" .. type(path))
|
print("expected arg path of type 'string' actual '" .. type(path))
|
||||||
|
|
|
@ -66,7 +66,7 @@ M.os = {}
|
||||||
function M.os.name()
|
function M.os.name()
|
||||||
-- Unix, Linux variants
|
-- Unix, Linux variants
|
||||||
local fh, err = assert(io.popen("uname -o 2>/dev/null", "r"))
|
local fh, err = assert(io.popen("uname -o 2>/dev/null", "r"))
|
||||||
if fh then
|
if err ~= nil and fh then
|
||||||
return fh:read()
|
return fh:read()
|
||||||
end
|
end
|
||||||
return "Windows"
|
return "Windows"
|
||||||
|
@ -82,4 +82,16 @@ function M.os.home()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.os.path = {}
|
||||||
|
|
||||||
|
function M.os.path.join(t)
|
||||||
|
local sep = nil
|
||||||
|
if M.os.name() == "Windows" then
|
||||||
|
sep = "\\"
|
||||||
|
else
|
||||||
|
sep = "/"
|
||||||
|
end
|
||||||
|
return table.concat(t, sep)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in New Issue