diff --git a/Aircraft/ufo/ufo.nas b/Aircraft/ufo/ufo.nas index 96b16077c..458fff010 100644 --- a/Aircraft/ufo/ufo.nas +++ b/Aircraft/ufo/ufo.nas @@ -832,7 +832,7 @@ var file_select_model = func { var fsel_callback = func(n) { var model = n.getValue(); - var root = string.fixpath(getprop("/sim/fg-root")) ~ "/"; + var root = string.normpath(getprop("/sim/fg-root")) ~ "/"; if (substr(model, 0, size(root)) == root) model = substr(model, size(root)); diff --git a/Nasal/io.nas b/Nasal/io.nas index d639b00c3..11db8151a 100644 --- a/Nasal/io.nas +++ b/Nasal/io.nas @@ -228,8 +228,8 @@ var writexml = func(path, node, indent = "\t", prefix = "___") { # _setlistener("/sim/signals/nasal-dir-initialized", func { # read IO rules - var root = string.fixpath(getprop("/sim/fg-root")); - var home = string.fixpath(getprop("/sim/fg-home")); + var root = string.normpath(getprop("/sim/fg-root")); + var home = string.normpath(getprop("/sim/fg-home")); var config = "Nasal/IOrules"; var rules_file = nil; @@ -284,14 +284,14 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { # make safe, local copies var setValue = props._setValue; var getValue = props._getValue; - var fixpath = string.fixpath; + var normpath = string.normpath; var match = string.match; var caller = caller; var die = die; # validators var valid = func(path, rules) { - var fpath = fixpath(path); + var fpath = normpath(path); foreach (var d; rules) if (match(fpath, d[0])) return d[1] ? fpath : nil; diff --git a/Nasal/string.nas b/Nasal/string.nas index b2af4e5f4..bcae8a4a8 100644 --- a/Nasal/string.nas +++ b/Nasal/string.nas @@ -78,7 +78,7 @@ var imatch = func(a, b) match(lc(a), lc(b)); ## var match = nil; -var fixpath = nil; +var normpath = nil; var join = nil; var replace = nil; @@ -189,7 +189,7 @@ match = func(str, patt) { # absolute property or file paths, otherwise ".." elements might # be resolved wrongly. # -fixpath = func(path) { +normpath = func(path) { path = replace(path, "\\", "/"); var prefix = size(path) and path[0] == `/` ? "/" : ""; var stack = []; diff --git a/gui/dialogs/file-select.xml b/gui/dialogs/file-select.xml index 62fd6669b..6488fe492 100644 --- a/gui/dialogs/file-select.xml +++ b/gui/dialogs/file-select.xml @@ -209,7 +209,7 @@ gui.dialog_update(dlgname, "file-input"); } if (new != nil) { - var p = string.fixpath(new); + var p = string.normpath(new); if (update(p)) current.dir = p; selection.setValue(""); @@ -221,7 +221,7 @@ } var dir_input = func { - var p = string.fixpath(dir.getValue()); + var p = string.normpath(dir.getValue()); if (update(p)) current.dir = p; gui.dialog_update(dlgname, "list"); @@ -234,7 +234,7 @@ var ok = func { dir_input(); file_input(); - var p = string.fixpath(current.dir ~ "/" ~ current.file); + var p = string.normpath(current.dir ~ "/" ~ current.file); var stat = io.stat(p); path.setValue(stat != nil and io.isdir(stat[2]) ? p ~ "/" : p); file.setValue(current.file); @@ -254,7 +254,7 @@ current.dir = (var d = dir.getValue()) != nil and d != "" ? d : getprop("/sim/fg-current"); current.file = (var d = file.getValue()) != nil and d != "" ? d : ""; gui.dialog_update(dlgname, "file-input"); ## dir-input ? - update(string.fixpath(current.dir)); + update(string.normpath(current.dir)); dir.setValue(current.dir);