CurrentPath Keyword

Description

Path name of the file.

Notes

CurrentPath is a keyword whose value is the path (not including the file name) of the file containing the reference to CurrentPath. You can use this keyword to locate files at runtime.

To get the path and the name of a file, use this:

CurrentPath + "\" + CurrentFile

Example

Consider this situation: You have a directory named Tests, which has two subdirectories: Scripts and Data. The Scripts directory contains script files. The Data directory contains supporting files used by the scripts. So that your scripts can always locate the Data directory, you could define the following function in an include file in the Tests directory:

STRING GetDataDir () return
(CurrentPath + "\data") 

Any script calling the GetDataDir function can locate the Data directory, even if a parent directory moves or is renamed. For example, if the Tests directory is c:\rel2\tests, GetDataDir returns

C:\rel2\tests\data

The CurrentPath keyword gets its value based on the file containing the reference to CurrentPath, in this case, the include file in the Tests directory.

If the parent directory is renamed to rel21 and moved to the e: drive, GetDataDir still locates the Data directory correctly, as

E:\rel21\tests\data