2,732
edits
Red Leader (talk | contribs) m (→Class: .new: Add Unix example) |
Red Leader (talk | contribs) No edit summary |
||
Line 15: | Line 15: | ||
==== new() ==== | ==== new() ==== | ||
{{Nasal doc | {{Nasal doc | ||
|syntax = | |syntax = os.path.new([path]); | ||
|text = Constructor function. Returns a new <code>os.path</code> instance. | |text = Constructor function. Returns a new <code>os.path</code> instance. Note that the path must not violate the rules for allowed paths. | ||
|param1 = path | |param1 = path | ||
|param1text = | |param1text = Optional string specifying the filepath. If not given, the path will default to [[$FG_ROOT]] | ||
|example1 = var path = os.path.new("C:/Windows"); # | |example1 = var path = os.path.new(); | ||
# var path = os.path.new("/usr/bin/"); # | print(path.realpath); # will print $FGROOT | ||
|example2 = var path = os.path.new("C:/Windows"); # Windows filepath | |||
# var path = os.path.new("/usr/bin/"); # Unix filepath | |||
print(path.realpath); | print(path.realpath); | ||
}} | }} | ||
==== set() ==== | ==== set() ==== | ||
{{Nasal doc | |||
|syntax = os.path.set([path]); | |||
|text = Sets the filepath. Note that the path must not violate the rules for allowed paths. | |||
|param1 = path | |||
|param1text = Optional string specifying the filepath. If not given, the path will be set to [[$FG_ROOT]] | |||
|example1 = var path = os.path.new("C:/Windows"); | |||
# var path = os.path.new("/usr/bin/"); # alternative Unix filepath | |||
print(path.realpath); | |||
path.set(); | |||
print(path.realpath); # will print $FG_ROOT | |||
|example2 = var path = os.path.new("C:/Windows"); | |||
# var path = os.path.new("/usr/bin/"); # alternative Unix filepath | |||
print(path.realpath); | |||
path.set("C:/Windows/Program Files"); | |||
# path.set("/usr/bin/"); # alternative Unix filepath | |||
print(path.realpath); # prints new path | |||
}} | |||
==== append() ==== | ==== append() ==== | ||
==== concat() ==== | ==== concat() ==== |