1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-06-30 18:08:51 +00:00

fixed: abspath on FreeBSD

This commit is contained in:
skywind3000
2019-02-10 16:05:10 +08:00
parent 849cd40c03
commit 332700fe12
+3 -8
View File
@@ -385,14 +385,9 @@ function os.path.abspath(path)
if test ~= nil and test ~= '' then
return test
end
end
if os.path.isdir(path) then
if os.path.exists('/bin/sh') and os.path.exists('/bin/pwd') then
local cmd = "/bin/sh -c 'cd \"" ..path .."\"; /bin/pwd'"
test = os.call(cmd)
if test ~= nil and test ~= '' then
return test
end
test = os.call('realpath \'' .. path .. '\' 2> /dev/null')
if test ~= nil and test ~= '' then
return test
end
end
local test = os.path.which('perl')