This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
Object to path

Object to path 


 

Object to path ( pathObject ) -> Function result 
Parameter Type   Description
pathObject  Object in Object describing a path contents
Function result  Text in 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:

  • 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:

PropertyTypeDescription
parentFolderTextDirectory 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.
nameTextFinal file or folder name of the specified path without extension.
extensionTextExtension of the final file or folder name. Starts with "." (can be omitted). Empty string "" if no extension.
isFolderBooleanTrue 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:

 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))



See also 

Convert path POSIX to system
Convert path system to POSIX
File
Folder
Path to object
Test path name

 
PROPERTIES 

Product: 4D
Theme: System Documents
Number: 1548

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16 R6

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)