KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Getting the path to the 4D Client folder
PRODUCT: 4D Client | VERSION: 6.8 | PLATFORM: Mac & Win
Published On: July 19, 2002
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Under 4D v6.8.x, getting the path to the 4D Client folder can be a bit tricky. Since under v6.8.x, the actual 4D Client application is inside the package, the command "Application File" under Mac OS 9 as well as Mac OS X returns a long pathname to the 4D Client inside the package. To get the path to the folder containing the 4D Client (not the one inside the package), all you need to do is truncate and customize the string returned by "Application File".





Let's take at a sample method which does this:



`Method "Get_Path"

`=====================

C_TEXT($1;$file_Path)

ARRAY INTEGER(position_of_slash;0)

$file_Path:=$1





PLATFORM PROPERTIES($vlPlatform)

If ($vlPlatform=3)

 $slash:="\"

Else

 $slash:=":"

End if



For ($i;1;Length($file_Path))

 $slash:=Substring($file_Path;$i;1)

 If (($slash="\") | ($slash=":"))

    $size_of_array:=Size of array(position_of_slash)

   INSERT ELEMENT(position_of_slash;$size_of_array+1)

   position_of_slash{$size_of_array+1}:=$i

 End if

End for





If ($vlPlatform<3)

 $size_of_array:=Size of array(position_of_slash)

 $numChars:=position_of_slash{$size_of_array-3}

 $0:=Substring($file_Path;1;$numChars)

Else

 $size_of_array:=Size of array(position_of_slash)

 $numChars:=position_of_slash{$size_of_array}

 $0:=Substring($file_Path;1;$numChars)

End if



` ==================





All that is needed is to pass to the method "Get_Path" the Application File Path and it returns the path to the 4D Client folder.





$path:=GetPath (Application file)