mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-14 11:49:48 +00:00
fixed: os.interpreter()
This commit is contained in:
24
z.lua
24
z.lua
@@ -379,6 +379,22 @@ function os.path.subdir(basename, subname)
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- check single name element
|
||||
-----------------------------------------------------------------------
|
||||
function os.path.single(path)
|
||||
if string.match(path, '/') then
|
||||
return false
|
||||
end
|
||||
if windows then
|
||||
if string.match(path, '\\') then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- expand user home
|
||||
-----------------------------------------------------------------------
|
||||
@@ -415,8 +431,12 @@ function os.interpreter()
|
||||
return nil
|
||||
end
|
||||
local lua = arg[-1]
|
||||
if lua == 'lua' then
|
||||
return os.path.which('lua')
|
||||
if os.path.single(lua) then
|
||||
local path = os.path.which(lua)
|
||||
if not os.path.isabs(path) then
|
||||
return os.path.abspath(path)
|
||||
end
|
||||
return path
|
||||
end
|
||||
return os.path.abspath(lua)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user