Use resolvepath() for canvas SVGs
This commit is contained in:
parent
0a93f65beb
commit
24ab67fa32
1 changed files with 6 additions and 16 deletions
|
@ -14,6 +14,12 @@ var parsesvg = func(group, path, options = nil)
|
||||||
if( typeof(options) != "hash" )
|
if( typeof(options) != "hash" )
|
||||||
die("Options need to be of type hash!");
|
die("Options need to be of type hash!");
|
||||||
|
|
||||||
|
# resolve paths using standard SimGear logic
|
||||||
|
var file_path = resolvepath(path);
|
||||||
|
if (file_path == "")
|
||||||
|
die("File not found: "~path);
|
||||||
|
path = file_path;
|
||||||
|
|
||||||
var custom_font_mapper = options['font-mapper'];
|
var custom_font_mapper = options['font-mapper'];
|
||||||
var font_mapper = func(family, weight)
|
var font_mapper = func(family, weight)
|
||||||
{
|
{
|
||||||
|
@ -573,22 +579,6 @@ var parsesvg = func(group, path, options = nil)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
# 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 = []);
|
call(func parsexml(path, start, end, data), nil, var err = []);
|
||||||
if( size(err) )
|
if( size(err) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue