Nasal library/os.path: Difference between revisions

Jump to navigation Jump to search
Finish
(More doc)
(Finish)
 
Line 223: Line 223:
}}
}}
==== str ====
==== str ====
{{Nasal doc
|syntax = os.path.str;
|text = A string giving the path that the instance points too.
This is to be used when a file has a double extension (e.g., <code>.tar.gz</code>). It also converts it to lowercase.  If the filepath points to a folder, it will be an empty string.
|example1 = var path = os.path.new("../temp/text.txt");
print(path.str); # prints "../temp/text.txt"
|example2 = var path = os.path.new(getprop("sim/fg-home"));
print(path.str); # prints the full path to $FG_HOME
}}
==== mtime ====
==== mtime ====
{{Nasal doc
|syntax = os.path.mtime;
|text = An integer giving the Unix time when the file or folder was last modified.
|example1 = var path = os.path.new(getprop("sim/fg-home"));
print(path.mtime); # prints a Unix time
}}


== Functions ==
== Functions ==
=== desktop() ===
=== desktop() ===
{{Nasal doc
|syntax = os.path.desktop();
|text = Creates and returns an <code>os.path</code> pointing to the desktop location.
{{Note|As of April 2018, this function does not work properly and returns the <code>/bin</code> folder.}}
|example1 = var path = os.path.desktop();
print(path.realpath);
}}
=== standardLocation() ===
=== standardLocation() ===
{{Nasal doc
|syntax = os.path.standardLocation(location);
|text = Creates and returns an <code>os.path</code> pointing to the standard location.
{{Note|As of April 2018, only supplying "HOME" to this function actually works. All the others do not work properly and return the <code>/bin</code> folder.}}
|param1 = location
|param1text = String specifying the standard location to use. May be one of <code>HOME</code>, <code>DESKTOP</code>, <code>DOWNLOADS</code>, <code>DOCUMENTS</code>, or <code>PICTURES</code>.
|example1 = var path = os.path.standardLocation("HOME");
print(path.realpath);
}}


{{Nasal namespaces}}
{{Nasal namespaces}}

Navigation menu