KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Folder Locations with Components
PRODUCT: 4D | VERSION: 14.x | PLATFORM: Mac & Win
Published On: October 19, 2016

When using a component that may require the locations of files and directories on the disk drive, there are some behaviors that should be noted.

Using the Get 4D folder command from the component will return the folders relative to the component, while using the command from the host database will perform as expected and return the folders relative to the host.

For Example, if using the following line:

$location:=Get 4D folder(Current resources folder)


From a normal database, the location would be:
Win:
$location="...\<databaseName>\Resources"

Mac:
$location="...:<databaseName>:Resources"


From a component, the location would be:
Win:
$location="...\<databaseName>\Components\<componentName>\Resources"

Mac:
$location="...:<databaseName>:Components:<componentName>:Resources"


However the an asterisk can be added as a second parameter to force the command to apply to the host database no matter where the command is called from, component or host.
$location2:=Get 4D folder(Current resources folder;*)

From a the host or a component database, the location would be in reference to the host database:
Win:
$location2="...\<databaseName>\Resources"

Mac:
$location2="...:<databaseName>:Resources"