Interface to local filesystem path definition.
Class Path( [path] )
path | The path that will be used as initial path. | ||
Raise |
|
This class offers an object oriented interface to access path elements given a complete path, or to build a path from its elements.
Builds the path object, optionally using the given parameter as a complete path constructor.
If the parameter is an array, it must have at least four string elements, and it will be used to build the path from its constituents. For example:
unit = "C" location = "/a/path/to" file = "somefile" ext = "anext" p = Path( [ unit, location, file, ext ] )
nil can be passed if some part of the specification is not used.
The path (or any part of it) may be specified both in RFC3986 format or in MS-Windows path format.
Note: Use the fileNameMerge() function to simply merge elements of a path specification into a string.
Properties | |
extension | File extension part. |
file | File part. |
filename | File name part. |
fulloc | Unit specificator and location. |
location | Location specificator. |
path | Complete path. |
unit | Unit specificator. |
winfulloc | Complete path in MS-Windows format. |
winloc | Complete path in MS-Windows format. |
winpath | Complete path in MS-Windows format. |
File extension part.
This element coresponds to the first last of the file element, if it is divided into a filename and an extension by a "." dot.
Note: If an extension is given, then filename is the same as file + "." + extension
File part.
This element coresponds to the first part of the file element, if it is divided into a filename and an extension by a "." dot.
Note: If an extension is given, then filename is the same as file + "." + extension
File name part.
This is the part of the path that identifies an element in a directory. It includes everything after the last "/" path separator.
Note: If an extension is given, then filename is the same as file + "." + extension
Unit specificator and location.
This property contains the location of this path, including the unit specificator, if present.
So, in a path like "/C:/path/to/me.txt", the fulloc property (notice the two 'l' characters in the name) will have the value of "/C:/path/to", while in a relative path like "relative/file.txt" it will take the same value of Path.location.
Assigning a value to this property means to change the value of both the unit specificator and location at the same time.
Location specificator.
This is the "path to file". It can start with a "/" or not; if it starts with a "/" it is considered absolute.
Complete path.
This is the complete path referred by this object.
Unit specificator.
This is the unit specificator (disk name) used in some filesystems. It is separated by the rest of the path via a ":". According to RFC 3986 it always starts with a "/", which is automatically added if absent.
Complete path in MS-Windows format.
This is the full location element in this path (unit specificator + location), given in MS-Windows format.
Use this if you need to produce scripts or feed it into external process on windows platforms. Normally, all the I/O functions used by Falcon on any platform understand the RFC3986 format.
Note: The property is read-only; you can anyhow assign a full location in MS-Windows format to the Path.fulloc property.
Complete path in MS-Windows format.
This is the location element in the complete path, given in MS-Windows format.
Use this if you need to produce scripts or feed it into external process on windows platforms. Normally, all the I/O functions used by Falcon on any platform understand the RFC3986 format.
Note: The property is read-only; you can anyhow assign a location in MS-Windows format to the Path.location property.
Complete path in MS-Windows format.
This is the complete path referred by this object, given in MS-Windows format.
Use this if you need to produce scripts or feed it into external process on windows platforms. Normally, all the I/O functions used by Falcon on any platform understand the RFC3986 format.
Note: The property is read-only; you can anyhow assign a path in MS-Windows format to the Path.path property.
See also: fileNameMerge.