Get 4D folder

4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next

version 2003 (Modified)


Get 4D folder String

ParameterTypeDescription
This command does not require any parameters
Function resultStringPathname to 4D Folder

Description

The Get 4D folder command returns the pathname to the active 4D folder of the current application. The 4D environment uses the 4D folder to store the following information:

User registration files

Preferences files used by the 4D environment applications, tools, and utility programs

TCP/IP Network protocol option file

.rex and .res files created by 4D Client for storing resources downloaded from 4D Server

Local database folders created by 4D Client for storing the 4D Extensions downloaded from 4D Server.

You can also use the 4D folder to store your own on-line help files, settings files, etc. By using the Get 4D folder command to get the actual pathname to that folder, you also ensure that your code will work on any platform running any localized system.

WARNING: You are free to store whatever files or documents you wish in the 4D folder; however, it is a good idea not to move or modify the files created by the 4D environment itself.

Starting in 4D 6.8, the 4D folder is created at the following location:

On Windows NT 4:

{Disk}:\{System folder}\Profiles\All Users\Application Data\4D

On Windows 98 and Windows Millenium:

{Disk}:\{System folder}\All users\Application Data\4D

On Windows 2000 and Windows XP:

{Disk}:\Documents and Settings\All Users\Application Data\4D

Note for 4D Client: With 4D Client under Windows 2000 and Windows XP, the active 4D folder is created at the following location:

{Disk}:\Documents and Settings\Current user\Application Data\4D

... where Current user is the name of the user that opened the current Windows session.

On MacOS 9:

{Disk}:System folder:Application Support:4D

On MacOS X:

{Disk}:Library:Application Support:4D

Compatibility Note: The location of the 4D folder has been modified in 4D 6.8 — in previous versions of 4D, this folder was placed, under Windows, in the Windows system file folder, and under MacOS, in the System:Preferences folder. If a previous version of 4D was used on the computer, the 4D 6.8 application will look for the 4D folder in the following locations:

1. New location (see above); the folder is used if it exists. Otherwise, 4D goes on to step 2.

2. Previous location (System); the folder is used if it exists. Otherwise, 4D goes on to step 3.

3. Creation of the 4D folder in the new location.

Example

During the startup of a single-user database, you want to load (or create) your own settings in a file located in the 4D folder. To do so, in the On Startup Database Method, you can write code similar to this:

   MAP FILE TYPES("PREF";"PRF";"Preferences file")
      ` Map PREF MacOS file type to .PRF Windows file extension
   $vsPrefDocName:=Get 4D folder+"MyPrefs"   ` Build pathname to the Preferences file
      ` Check if the file exists
   If (Test path name($vsPrefDocName+(".PRF"*Num(On Windows)))#Is a document) 
      $vtPrefDocRef:=Create document($vsPrefDocName;"PREF") ` If not, create it
   Else
      $vtPrefDocRef:=Open document($vsPrefDocName;"PREF") ` If so, open it
   End if
   If (OK=1)
         ` Process document contents
      CLOSE DOCUMENT($vtPrefDocRef)
   Else
         ` Handle error
   End if

See Also

System folder, Temporary folder, Test path name.


4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next