Tech Tip: Filesystem pathnames for File and Folder
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: May 9, 2025
The 4D Folder and File commands offer various options to interact with files and directories on the system where the database application is running. These commands use classes and functions to provide their functionality.
To use these commands, you must pass a path to initialize the class object. A notable feature of these commands is support for filesystem path names, which can be used in place of full paths.
For example:
- Full Path: C:/User/Documents/4D_Data/
- Filesystem Path Name: /DATA
- Current data folder - "/DATA"
- Log folder - "/LOGS"
- Project rool folder - "/PACKAGE"
- Project folder - "/PROJECT"
- Current project resources folder - "/RESOURCES"
- Current project sources folder - "/SOURCES"
- The .parent property is Null when using the filesystem path name, adding a layer of security by hiding parent directory information if needed.
- Certain properties reference /SOURCES/ instead of providing values derived from the full path.
- The path format must be POSIX-compliant.
- The filesystem portion must be in uppercase.
- Subfile and subdirectory names do not require uppercase and are case-insensitive.
- /RESOURCES/Images
- /RESOURCES/images
- /RESOURCES/IMAGES
- /RESOURCES/ImAgEs
- They simplify code by reducing the character count compared to full paths.
- They improve code security by obfuscating the full directory structure.
- They make the code more generic and adaptable.