1.31Class Path

Interface to local filesystem path definition.

Class Path( [path] )
path The path that will be used as initial path.
Raise
ParamError in case the inital path is malformed.

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
extensionFile extension part.
fileFile part.
filenameFile name part.
fullocUnit specificator and location.
locationLocation specificator.
pathComplete path.
unitUnit specificator.
winfullocComplete path in MS-Windows format.
winlocComplete path in MS-Windows format.
winpathComplete path in MS-Windows format.

Properties

extension

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

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

filename

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

fulloc

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

Location specificator.

This is the "path to file". It can start with a "/" or not; if it starts with a "/" it is considered absolute.

path

Complete path.

This is the complete path referred by this object.

unit

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.

winfulloc

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.

winloc

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.

winpath

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.

Made with http://www.falconpl.org