loadResource

Return the absolute path name of a URI or local file name

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

fileReference = Files.loadResource(uri);

Description

The function call "Files.loadResource(uri)" returns the absolute path name of the file that is either defined by an URI or by a local path name. With the returned file name it is possible to access the file with function calls of the C standard library. If the data or file is stored in a data-base, this might require copying the resource to a temporary folder and referencing that.

The implementation of this function is tool specific. However, at least Modelica URIs (see "chapter 13.2.3 External Resources" of the Modelica Specification), as well as absolute local file path names are supported.

Example

file1 = loadResource("modelica://Modelica/Resources/Data/Utilities/Examples_readRealParameters.txt")
        // file1 is the absolute path name of the file
file2 = loadResource("C:\data\readParameters.txt")
        file2 = "C:/data/readParameters.txt"

Syntax

fileReference = loadResource(uri)

Inputs (1)

uri

Type: String

Description: URI or local file name

Outputs (1)

fileReference

Type: String

Description: Absolute path name of file