4D v16.3Get 4D folder |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
Get 4D folder
Get 4D folder
The Get 4D folder command returns the pathname to the active 4D folder of the current application, or to the 4D environment folder specified by the folder parameter, if passed. This command allows you to get the actual pathname of the folders used by the 4D application. By using this command, you ensure that your code will work on any platform running any localized system. In folder, you can pass one of the following constants, which are located in the "4D Environment" theme:
You will find below a description of each folder: Preliminary notes about folder names:
The 4D environment uses a specific folder to store the following information:
With the main 4D applications (4D and 4D Server), the active 4D folder is named 4D and is created by default at the following location:
Starting with 4D v13, in the case of an application merged with 4D Volume Desktop, the active 4D folder is found at the following location:
Folder containing the Licenses files of the machine.
Notes:
Path of the folder containing the current data file. The pathname is expressed using the standard syntax of the current platform. 4D database folder created on each 4D client machine for storing files and folders related to the database (resources, plug-ins, Resources folder, etc.).
Folder containing the database structure file. The pathname is expressed using the standard syntax of the current platform. Folder containing the database structure file. This constant designates the same folder as the previous one but the pathname returned is expressed using the Unix syntax (Posix), of the type /Users/... This syntax is mainly used when you use the LAUNCH EXTERNAL PROCESS command under OS X. Resources folder of the database. This folder contains the additional items (pictures, texts) used for the database interface. A component can have its own Resources folder. The Resources folder is located next to the database structure file. Note: If the Resources folder does not exist for the database, executing the Get 4D folder command with the Current resources folder constant will create it. The Logs folder of the database. This folder centralizes the log files of the current database. It is created at the same level as the structure file and contains the following log files:
Note: If the Logs folder does not exist for the database, executing the Get 4D folder command with the Logs folder constant will create it. Current HTML root folder of the database. The pathname returned is expressed with the standard syntax of the current platform. The HTML root folder is the folder in which the 4D Web server looks for the requested Web pages and files. By default, it is named WebFolder and is placed next to the structure file (or its local copy in the case of 4D in remote mode). Its location can be set on the Web/Configuration page of the Preferences or dynamically via the WEB SET ROOT FOLDER command. If the Get 4D folder command is called from a remote 4D, the path returned is that of the remote machine, not that of 4D Server. The optional * parameter is useful in the case of an architecture using components: it can be used to determine the database (host or component) for which you want to get the folder pathname. This parameter is only valid for Database folder, Database folder UNIX syntax and Current resources folder folders. It is ignored in all other cases.
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") This example illustrates the use of the Database folder UNIX syntax constant under Mac OS to list the contents of the database folder: $posixpath:="\""+Get 4D folder(Database folder Unix syntax)+"\"" Note: Under Mac OS, it is necessary to put pathnames in quotes when they contain the names of files or folders with spaces in them. The escape sequence "\" can be used to insert the quotation mark character into the string. You can also use the statement Char(Double quote). If the folder parameter is invalid or if the pathname returned is empty, the OK system variable is set to 0.
See also
COMPONENT LIST
|
PROPERTIES
Product: 4D HISTORY
TAGS Folder ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||