Fix relative paths in simfiles. (#1512)
This commit is contained in:
@@ -62,16 +62,27 @@ setmetatable( Def, {
|
|||||||
if t._Level then
|
if t._Level then
|
||||||
level = t._Level + 1
|
level = t._Level + 1
|
||||||
end
|
end
|
||||||
local info = debug.getinfo(level,"Sl");
|
local info
|
||||||
|
|
||||||
-- Source file of caller:
|
-- Sometimes info.source will be "=(tail call)" when we need the actual
|
||||||
local Source = info.source
|
-- file something came from.
|
||||||
t._Source = Source
|
-- So this loop climbs the stack until it reaches an actual file path
|
||||||
|
-- or reaches end.
|
||||||
|
repeat
|
||||||
|
info = debug.getinfo(level,"Sl");
|
||||||
|
if info then
|
||||||
|
-- Source file of caller:
|
||||||
|
local source= info.source
|
||||||
|
t._Source= source
|
||||||
|
-- Line number of caller:
|
||||||
|
t._Line = info.currentline
|
||||||
|
t._Dir= DebugPathToRealPath(source)
|
||||||
|
|
||||||
t._Dir = DebugPathToRealPath( Source )
|
-- level is incremented for the next time through the loop. Take
|
||||||
|
-- that into account if level is used after the loop.
|
||||||
-- Line number of caller:
|
level= level + 1
|
||||||
t._Line = info.currentline
|
end
|
||||||
|
until t._Dir or not info
|
||||||
|
|
||||||
setmetatable( t, DefMetatable )
|
setmetatable( t, DefMetatable )
|
||||||
return t
|
return t
|
||||||
|
|||||||
Reference in New Issue
Block a user