Skip to main content
Version: Next

Convert path system to POSIX

Convert path system to POSIX ( systemPath {; *} ) -> Function result

ParameterTypeDescription
systemPathText🡒Relative or absolute pathname expressed in system syntax
*Operator🡒Encoding option
Function resultText🡐Absolute pathname expressed in POSIX syntax

Description

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

Example 1

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 2

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
Object to path
Path to object
Test path name