KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to convert an HFS path to POSIX in 4D code?
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac OS X
Published On: February 20, 2008
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is a small bit of 4D code that can be used to convert a Mac OS X HFS path to a POSIX path. For example, it will convert:

Mac HD:User:MyUserName:Library



To:

/Volumes/Mac HD/User/MyUserName/Library



Here is the code:

C_TEXT($1;$original)
C_TEXT($0;$converted)

$original:=$1

$original:=Replace string($original;":";"/")
$original:=Replace string($original;" ";"\\ ")
$converted:="/Volumes/"+$original

$0:=$converted