Nasal library/os.path: Difference between revisions
Jump to navigation
Jump to search
Red Leader (talk | contribs) No edit summary |
Red Leader (talk | contribs) m (→Class: .new: Add Unix example) |
||
Line 19: | Line 19: | ||
|param1 = path | |param1 = path | ||
|param1text = A string pointing to a filepath. | |param1text = A string pointing to a filepath. | ||
|example1 = # | |example1 = var path = os.path.new("C:/Windows"); # A Windows filepath | ||
var path = os.path.new(" | # var path = os.path.new("/usr/bin/"); # A Unix filepath | ||
print(path.realpath); | print(path.realpath); | ||
}} | }} |
Revision as of 19:28, 11 February 2018
The FlightGear forum has a subforum related to: Nasal Scripting |
Nasal scripting |
---|
Nasal internals |
---|
Memory Management (GC) |
This page contains documentation for the os.path
namespace in Nasal. This namespace implements tools (from SGPath) for manipulating file paths. Everything in the geo
namespace is sourced from flightgear/src/Scripting/NasalSGPath.cxx
Tip Copy & paste the examples into your Nasal Console and execute them to see what they do. |
Note Everything here was added to FlightGear 3.0. |
Class
os.path
A pseudo-class (actually a Nasal ghost). This is the main class that stores and allows manipulation of file paths. This is also integrated into the os.path
.
new()
geo.Coord.new(path);
Constructor function. Returns a new os.path
instance.
- path
- A string pointing to a filepath.
Example
var path = os.path.new("C:/Windows"); # A Windows filepath
# var path = os.path.new("/usr/bin/"); # A Unix filepath
print(path.realpath);