KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Unexpected Information When Trying to Obtain File/Folder Info
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: March 16, 2020

The commands Path to object, File, and Folder are useful for obtaining information regarding a file/folder. When passing a pathname into these commands, the second parameter allows the developer to define the path type as either System or POSIX. The second parameter does not change the path type, it defines the type for the command to interpret it correctly. If the path type defined in the second parameter is different than the inserted pathname, it may return information with unexpected results.

The images below show a user trying to return information regarding their database folder that is saved on their dekstop. The code below inserts the system type pathname in the Folder command then defines the path as POSIX in the second parameter.

$path:=Get 4D folder(Database folder)
$folder:=Folder($path;fk posix path)

When there is a mismatch, the returned information may be unexpected. In the example, the information for creationDate, creationTime, exists are a few that displays very odd results.



The image below shows the expected information. It is very important to define the correct path type in the second parameter when using these commands.