KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Relative path names are not always relative to the same starting point
PRODUCT: 4D | VERSION: 13.2 | PLATFORM: Mac & Win
Published On: January 24, 2013

If you are fielding a multi-lingual application you may have files, such as images, the are language specific, along with the xliff files. 4D v12 makes it very easy to access those files based on the current database localization.

In the Resources folder, in the target xxx.lproj folder (where xxx represents a language) place the language specific files, individually or in subfolders. Then to access those files quickly and easily depend on the new v12 command: Get localized document path (relativePath ) -> Function result

When 4D documentation normally refers to relativePath it is talking about a file path that relative to the database structure file (.4DB or .4DC). When the relativePath of this command is referred to the path is relative to the first level of the current "xxx.lproj" folder of the database.

Assume you have inside the current xxx.lproj subfolder a folder named "images" and in that folder is an image named "Button_1.png". The relative path to be used with Get localized document path is "images\Button_1.png", not "Resources\xxx.lproj\images\Button_1.png". You can express the contents of the relativePath in either system or a POSIX syntax.

C_TEXT($absolutePath_T;$relativePath_T)

$relativePath_T:="images\Button_1.png"
$absolutePath_T:=Get localized document path($relativePath_T)


The absolute pathname, $absolutePath_T, returned by the command is always expressed in the system syntax, making it easy to use other 4D commands, such as Open document, which depends on path names expressed in system syntax, to access the appropriate file.