This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
Object to path
|
Object to path ( pathObject ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
pathObject | Object |
![]() |
Object describing a path contents | |||||
Function result | Text |
![]() |
Pathname | |||||
The Object to path command returns a pathname (string) based upon path information you passed in the pathObject parameter. The following paths are supported:
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.
We want to duplicate and rename a file in its own folder:
C_OBJECT($o)
$o:=New object
C_TEXT($path)
$path:="C:\\MyDocs\\file.txt"
$o:=Path to object($path)
$o.name:=$o.name+"_copy"
COPY DOCUMENT($path;Object to path($o))
Convert path POSIX to system
Convert path system to POSIX
File
Folder
Path to object
Test path name
Product: 4D
Theme: System Documents
Number:
1548
Created: 4D v16 R6
4D Language Reference ( 4D v20 R7)