Skip to content

DFPATH and DF_OPEN_PATH

Include: Use System\FileSystem.pkg

DF_OPEN_PATH is a semicolon-separated list of folders used to resolve relative file names for the FILE driver.

Set it with Set_Attribute DF_OPEN_PATH to "dfpath2;dfpath1". Clear it with Set_Attribute DF_OPEN_PATH to "".

When DF_OPEN_PATH is set, Direct_Input "name.txt", File_Exist "name.txt", and Get_File_Path "name.txt" can find name.txt in those folders even when it is not in the current working folder.

Search order follows the order in the attribute value. Paths are tried before falling back to the supplied file name.

Get_File_Path returns the resolved path or an empty string when no matching file can be found.

Example

This example assumes dfpath1/dfpathfile.txt exists.

Handle hFile
String sResolvedPath sData

Set_Attribute DF_OPEN_PATH to "dfpath2;dfpath1"
Get_File_Path "dfpathfile.txt" to sResolvedPath

If (sResolvedPath <> "") Begin
    Get Seq_New_Channel to hFile
    If (hFile <> DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin
        Direct_Input Channel hFile sResolvedPath
        Read_Line Channel hFile sData
        Close_Input Channel hFile
        Send Seq_Release_Channel hFile
    End
End

Set_Attribute DF_OPEN_PATH to ""

DF_OPEN_PATH resolves existing paths for the FILE driver. It does not control output creation paths.