KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieving the absolute path of the Desktop folder
PRODUCT: 4D | VERSION: 2003 | PLATFORM: Mac & Win
Published On: July 1, 2003

Here is a simple method that will return the absolute path of the Desktop folder as the function result.

  ` Project Method: Desktop_Folder
  ` Return: Path to the Desktop folder

C_TEXT($0;$path;$4Dfolder)
C_LONGINT($platform;$system;$vlSys;$i)
PLATFORM PROPERTIES($platform;$system)
If ($platform=3)
   $path:=System folder(Desktop Win )
Else
   $vlSys:=$system\256
   If ($vlSys=16)
      $path:=System folder(Preferences or Profiles_User )
      $path:=Replace string($path;"Library:Preferences:";"Desktop:")
   Else
      $4Dfolder:=System folder(System )
      For ($i;1;Length($4Dfolder))
         If ($4Dfolder[[$i]]=":")
            $path:=Substring($4Dfolder;1;$i)+"Desktop Folder:"
            $i:=Length($4Dfolder)+1
         End if
      End for
   End if
End if
$0:=$path