pure functiongetAbsolutePath
Gets the absolute path of a URI
Extends from Modelica.Icons.Function (Icon for functions).
Information
The function returns the absolute path of a
uniform resource identifier (URI) or local file name.
If the file is not found, then this function
terminates with an assert.
This function has been introduced to allow users to specify the name of weather data files with a path that is relative to the library path. This allows users to change the current working directory while still being able to read the files.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | uri | A URI |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | path | The absolute path of the file pointed to by the URI |
Revisions
-
December 11, 2021, by Michael Wetter:
Removed assertion if file does not exist. This has been removed because it makes the function impure, and then the test Buildings.BoundaryConditions.WeatherData.BaseClasses.Examples.GetAbsolutePath fails. -
July 07, 2016, by Thierry S. Nouidui:
Removed the use ofModelica.Utilities.Files.fullPathNamewhich is implicitly done inModelica.Utilities.Files.loadResource.
Removed the addition offile://to file names which do not start withfile://, ormodelica://. This is not required when usingModelica.Utilities.Files.loadResource. -
April 21, 2016, by Michael Wetter:
ReplacedModelicaServices.ExternalReferences.loadResourcewithModelica.Utilities.Files.loadResource. -
October 8, 2013, by Michael Wetter:
Improved algorithm that determines the absolute path of the file. Now the function works from any directory as long as theBuildingslibrary is on theMODELICAPATH. -
May 2, 2013, by Michael Wetter:
First implementation.