parsesvg: fix checking for relative/absolute path
This commit is contained in:
parent
6d8940c4e0
commit
ef95c4cf10
1 changed files with 15 additions and 2 deletions
|
@ -426,8 +426,21 @@ var parsesvg = func(group, path, options = nil)
|
|||
stack[-1].setText(data);
|
||||
};
|
||||
|
||||
if( path[0] != '/' )
|
||||
path = getprop("/sim/fg-root") ~ "/" ~ path;
|
||||
# check path relative to standard locations
|
||||
foreach(
|
||||
var p;
|
||||
[ "", # absolute path
|
||||
getprop("/sim/aircraft-dir") ~ "/", # current aircraft path
|
||||
getprop("/sim/fg-root") ~ "/" # fgdata
|
||||
])
|
||||
{
|
||||
var tmp_path = p ~ path;
|
||||
if( io.stat(tmp_path) != nil )
|
||||
{
|
||||
path = tmp_path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
call(func parsexml(path, start, end, data), nil, var err = []);
|
||||
if( size(err) )
|
||||
|
|
Loading…
Reference in a new issue