Tech Tip: Retrieving the absolute path to the app folder
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: March 17, 2006
The following method returns the absolute path to the application or structure folder on the both Mac and PC platforms:
` Method: RetreiveRootPath
C_LONGINT($platform;$length;$where)
C_TEXT($0;$sep;$path)
PLATFORM PROPERTIES($platform)
If ($platform=3)
$sep:="\\"
Else
$sep:=":"
End if
If ((Application type=1) & ($sep=":"))
$path:=Replace string(Application file;".app";"")
Else
$path:=Structure file
End if
$length:=Length($path)
$where:=$length
Repeat
$where:=$where-1
Until ($path≤$where≥=$sep)
$0:=Substring($path;1;$where)