forked from izaya/OC-PsychOS2
made fs.lua support relative paths
This commit is contained in:
parent
2f48091a07
commit
7615cf67dc
@ -10,6 +10,8 @@ function fs.segments(path)
|
|||||||
return segments
|
return segments
|
||||||
end
|
end
|
||||||
function fs.resolve(path)
|
function fs.resolve(path)
|
||||||
|
if not path or path == "." then path = os.getenv("PWD") end
|
||||||
|
if path:sub(1,1) ~= "/" then path=(os.getenv("PWD") or "").."/"..path end
|
||||||
local segments, rpath = fs.segments(path), "/"
|
local segments, rpath = fs.segments(path), "/"
|
||||||
for i = 2, #segments do
|
for i = 2, #segments do
|
||||||
rpath = rpath .. segments[i] .. "/"
|
rpath = rpath .. segments[i] .. "/"
|
||||||
|
Loading…
Reference in New Issue
Block a user