s/fixpath/normpath/ (as in python)
This commit is contained in:
parent
8c7e7cb994
commit
c350a7b6a8
4 changed files with 11 additions and 11 deletions
|
@ -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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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);
|
||||
</open>
|
||||
</nasal>
|
||||
|
|
Loading…
Reference in a new issue