4D v16.3

Convert path system to POSIX

Home

 
4D v16.3
Convert path system to POSIX

Convert path system to POSIX 


 

Convert path system to POSIX ( systemPath {; *} ) -> Function result 
Parameter Type   Description
systemPath  Text in Relative or absolute pathname expressed in system syntax
Operator in Encoding option
Function result  Text in Absolute pathname expressed in POSIX syntax

The Convert path system to POSIX command converts a pathname expressed with the system syntax as a pathname expressed with the POSIX (Unix) syntax.

Pass the pathname for a file or folder in the systemPath parameter, expressed with the system syntax (Mac OS or Windows). This path may be absolute or relative to the database folder (folder containing the database structure file). It is not mandatory that the elements of the path actually exist on the disk at the time the command is executed (the command does not test the validity of the pathname). 

The command returns the complete pathname of the file or folder expressed in the POSIX syntax. The command always returns an absolute pathname, regardless of the type of path passed in systemPath. If you passed a relative pathname in systemPath, 4D completes the value returned by adding the pathname of the database folder. 

The optional * parameter can be used to specify the encoding of the POSIX path. By default, Convert path system to POSIX does not encode the special characters of the POSIX path. If you pass the * parameter, the special characters are translated (for example, "My folder" becomes "My%20folder").

Examples under OS X

 $path:=Convert path system to POSIX("machd:file 2.txt")
  //machd is the startup disk
  //returns "/file 2.txt"
 $path:=Convert path system to POSIX("disk2:file 2.txt")
  //disk2 is an additional disk (not the startup)
  //returns "/Volumes/disk2/file 2.txt"
 $path:=Convert path system to POSIX("machd:file 2.txt";*)
  //returns "/file%202.txt"
 $path:=Convert path system to POSIX(":resources:images") //relative path
  //returns "/User/mark/Documents/videodatabase/resources/images"
 $path:=Convert path system to POSIX("resources:images") //absolute path
  //returns "/resources/images"

Example under Windows

 $path:=Convert path system to POSIX("c:\docs\file 2.txt")
  `returns "c:/docs/file 2.txt"
 $path:=Convert path system to POSIX("\\srv\tempo\file.txt")
  `returns "//srv/tempo/file.txt"



See also 

Convert path POSIX to system
Test path name

 
PROPERTIES 

Product: 4D
Theme: System Documents
Number: 1106

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v12

 
TAGS 

Chemin accès, POSIX

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)