Namespace LrPathUtils
Access the functions directly from the imported namespace.
Summary
.. (dot dot) and ~ (home).Functions
- LrPathUtils.addExtension( path, extension )
-
Adds a new filename extension to a path. Appends the new extension after any existing extension.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
- 2. extension
- (string) The new extension to append.
Return value
(string) The path with the new extension appended. - LrPathUtils.child( path, child )
-
Combines path elements into a single path.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The base path; for example, 'C:\MyDir\'
- 2. child
- (string) A child directory or filename to append; for example, 'MyFile'.
Return value
(string) The combined path; for example, 'C:\MyDir\MyFile' - LrPathUtils.extension( path )
-
Retrieves the filename extension (if any) from the path.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(string) The extension, or an empty string if there is no extension. - LrPathUtils.getStandardFilePath( which )
-
Retrieves the path to a standard directory, as defined for the platform.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. which
- (string) The desired path. One of: 'home', 'temp', 'desktop', 'appPrefs', 'pictures', 'documents'
Return value
(string) The full path to the specified standard directory. - LrPathUtils.isAbsolute( path )
-
Reports whether a path is absolute or relative. This is the converse of
LrPathUtils.isRelative().First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(Boolean) True if it is an absolute path, false if it is a relative path. - LrPathUtils.isRelative( path )
-
Reports whether a path is absolute or relative. This is the converse of
LrPathUtils.isAbsolute().First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(Boolean) True if it is a relative path, false if it is an absolute path. - LrPathUtils.leafName( path )
-
Retrieves the leaf name from a path.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(string) The final path component. - LrPathUtils.makeAbsolute( path, base )
-
Converts a relative path to an absolute path if possible.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The relative path.
- 2. base
- (string) The base path.
Return value
(string) The absolute path, or a path relative to the new base location. - LrPathUtils.makeRelative( path, base )
-
Converts an absolute path to a relative path if possible.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
- 2. base
- (string) The base location, from which to make path relative.
Return value
(string) The path, modified to be relative to the new base location. - LrPathUtils.maxPathLength()
-
Reports the maximum permissible path length for the current platform.
First supported in version 1.3 of the Lightroom SDK.
Return value
(number) The maximum path length in characters. - LrPathUtils.parent( path )
-
Retrieves the parent directory of a path.
First supported in version 1.3 of the Lightroom SDK.
Note: This function has changed slightly between 1.3 and 2.0. In Lightroom 1.3 and 1.4, if you called this function for a file system root (i.e. "/" on Mac or "C:\\" on Windows), the result was not clearly defined and, in practice, was inconsistent between platforms. As of Lightroom 2.0, the result of such a call is nil on both platforms.
Parameters
- 1. path
- (string) The file path.
Return value
(string) The path to the parent directory. - LrPathUtils.removeExtension( path )
-
Removes the filename extension from a path, if it has one.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(string) The path without any extension. - LrPathUtils.replaceExtension( path, extension )
-
Changes the filename extension of a path, replacing any existing extension.
First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
- 2. extension
- (string) The new extension.
Return value
(string) The path with the new extension. - LrPathUtils.standardizePath( path )
-
Standarizes a path, resolving links and shortcuts such as
..(dot dot) and~(home).First supported in version 1.3 of the Lightroom SDK.
Parameters
- 1. path
- (string) The path.
Return value
(string) The path in canonical form.