Skip to content

Script Development / Resource Path DFF.RSRC

Resource files can be viewed and managed under Management / File Tools. When you need to read or write resource files through the Python file API, use DFF.RSRC(...) to obtain their real path in the current installation environment.

Parameter Type Required / Default Description
file_path str Required Relative path in the resource directory
Example
1
2
3
path = DFF.RSRC('demo/data.txt')
with open(path, encoding='utf-8') as f:
    data = f.read()

The path is resolved under the configured resource root directory and cannot escape that directory. The resource root directory is usually /data/resources, but a Script should not hardcode this path, because the returned absolute path depends on the specific installation.

When using DFF.RESP_FILE(...) to return a resource file, pass the resource relative path directly; there is no need to call DFF.RSRC(...) first.

Do not pass arbitrary request paths directly to DFF.RSRC(...). Before accessing a file, select the resource path from an allowlist, or validate it according to the application's own strict prefix and file name rules.