KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: A quick way to get the platform-specific folder delimiter character
PRODUCT: 4D | VERSION: 11.3 | PLATFORM: Mac & Win
Published On: March 25, 2009

You can find the path to your database folder using Get 4D Folder. Accessing a subfolder within the database folder would require a path to the folder.

At this point, it is necessary to verify the platform type and get the folder delimiter. For Mac OS X, it is ":" and for Windows it is "\" . Using this information, you can construct the full path to the subfolder. This can be done very quick and easy without finding the platform type.

If we look at the path returned from Get 4D Folder, we see that the last element is actually the OS delimiter. We can extract the folder delimiter character by using just two lines of code. An example follows; $folderDelimiter holds the OS specific character after execution.

C_TEXT($folderDelimiter;$folderPath)

$folderPath:=Get 4D Folder(Database_Folder)
$folderDelimiter:=$folderPath[[Length($folderPath)]]

Commented by Tim Penner on August 6, 2009 at 4:06 PM
This can also be written in one line like so:
$delim:=(Get 4D folder(Database Folder )[[Length(Get 4D folder(Database Folder ))]])
Commented by Luis Pineiros on March 27, 2009 at 5:55 PM
You can use this technique on Startup and save the result on an interprocess variable, so you won't have to repeat the process every time you need this information.