1
0
Fork 0

Change Nasal to use relative not absolute data paths

(requires current FG git)
This commit is contained in:
James Turner 2010-08-15 11:27:15 +01:00
parent 1c16c8f246
commit 83c9e8b157
3 changed files with 7 additions and 5 deletions

View file

@ -606,7 +606,7 @@ var overlay_update = {
return m;
},
add: func(path, prop, callback = nil) {
var path = string.normpath(getprop("/sim/fg-root") ~ '/' ~ path) ~ '/';
var path = path ~ '/';
me.data[path] = [me.root.initNode(prop, ""), "",
typeof(callback) == "func" ? callback : func nil];
return me;

View file

@ -287,7 +287,7 @@ var Dialog = {
me.close();
me.prop.removeChildren();
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ me.path, me.prop);
io.read_properties(me.path, me.prop);
var n = me.prop.getNode("name");
if (n == nil)
@ -372,8 +372,10 @@ var OverlaySelector = {
var m = Dialog.new(data.getNode("dialog", 1), "gui/dialogs/overlay-select.xml", name);
m.parents = [OverlaySelector, Dialog];
m.dir = string.normpath(getprop("/sim/fg-root") ~ '/' ~ dir) ~ '/';
# resolve the path in FG_ROOT, and --fg-aircraft dir, etc
m.dir = resolvepath(dir) ~ "/";
var relpath = func(p) substr(p, p[0] == `/`);
m.nameprop = relpath(nameprop);
m.sortprop = relpath(sortprop or nameprop);

View file

@ -468,7 +468,7 @@ var dialog = func {
#
var load = func(file, index = 0) {
props.globals.getNode("/sim/tutorials", 1).removeChild("tutorial", index);
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
io.read_properties(file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
}