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

TypeNameDefaultDescription
StringuriA URI

Outputs

TypeNameDefaultDescription
StringpathThe 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 of Modelica.Utilities.Files.fullPathName which is implicitly done in Modelica.Utilities.Files.loadResource.
    Removed the addition of file:// to file names which do not start with file://, or modelica://. This is not required when using Modelica.Utilities.Files.loadResource.
  • April 21, 2016, by Michael Wetter:
    Replaced ModelicaServices.ExternalReferences.loadResource with Modelica.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 the Buildings library is on the MODELICAPATH.
  • May 2, 2013, by Michael Wetter:
    First implementation.