From 24ab67fa32e6aef4b5a3026b3099c3ee57435d14 Mon Sep 17 00:00:00 2001 From: Philosopher Date: Sun, 6 Oct 2013 11:52:30 -0500 Subject: [PATCH] Use resolvepath() for canvas SVGs --- Nasal/canvas/svg.nas | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Nasal/canvas/svg.nas b/Nasal/canvas/svg.nas index 7dfbdf342..0579a3d4a 100644 --- a/Nasal/canvas/svg.nas +++ b/Nasal/canvas/svg.nas @@ -14,6 +14,12 @@ var parsesvg = func(group, path, options = nil) if( typeof(options) != "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 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 = []); if( size(err) ) {