Object to path
Object to path ( pathObject ) : Text
Parameter | Type | Description | |
---|---|---|---|
pathObject | Object | → | Object describing a path contents |
Function result | Text | ← | Pathname |
Description
The Object to path command returns a pathname (string) based upon path information you passed in the pathObject parameter. The following paths are supported:
- System path (Windows or macOS) or Posix path. The path type is defined by the last character of the parentFolder property (see below).
- Relative path or absolute path (see Absolute or relative pathname for more information).
In pathObject, pass an object defining the path you want to generate. It must contain the following properties:
Property | Type | Description |
---|---|---|
parentFolder | Text | Directory information for the path. The last character must be a folder separator. This character is used by the command to know the path type. If it is a Posix separator ("/"), the path is created with Posix separators; otherwise, the system separator is used. |
name | Text | Final file or folder name of the specified path without extension. |
extension | Text | Extension of the final file or folder name. Starts with "." (can be omitted). Empty string "" if no extension. |
isFolder | Boolean | True if name is a folder name, false otherwise (default is false) |
Usually, pathObject will be generated by the Path to object command, however the object can be built with any means. Note that Object to path only handles strings. It neither checks if the path is valid with regards to the path type, nor the actual existence of any file or folder.
Example
We want to duplicate and rename a file in its own folder:
var $o : Object
$o:=New object
var $path : Text
$path:="C:\\MyDocs\\file.txt"
$o:=Path to object($path)
$o.name:=$o.name+"_copy"
COPY DOCUMENT($path;Object to path($o))
See also
Convert path POSIX to system
Convert path system to POSIX
File
Folder
Path to object
Test path name
Properties
Command number | 1548 |
Thread safe | ✓ |