.Modelica.Utilities.Files

Information

This package contains functions to work with files and directories. As a general convention of this package, '/' is used as directory separator both for input and output arguments of all functions. For example:

exist("Modelica/Mechanics/Rotational.mo");

The functions provide the mapping to the directory separator of the underlying operating system. Note, that on Windows system the usage of '\' as directory separator would be inconvenient, because this character is also the escape character in Modelica and C Strings.

In the table below an example call to every function is given:

Function/typeDescription
list(name) List content of file or of directory.
copy(oldName, newName)
copy(oldName, newName, replace=false)
Generate a copy of a file or of a directory.
move(oldName, newName)
move(oldName, newName, replace=false)
Move a file or a directory to another place.
remove(name) Remove file or directory (ignore call, if it does not exist).
removeFile(name) Remove file (ignore call, if it does not exist)
createDirectory(name) Create directory (if directory already exists, ignore call).
result = exist(name) Inquire whether file or directory exists.
assertNew(name,message) Trigger an assert, if a file or directory exists.
fullName = fullPathName(name) Get full path name of file or directory name.
(directory, name, extension) = splitPathName(name) Split path name in directory, file name kernel, file name extension.
fileName = temporaryFileName() Return arbitrary name of a file that does not exist
and is in a directory where access rights allow to
write to this file (useful for temporary output of files).
fileReference = loadResource(uri) Return the absolute path name of a URI or local file name.

Contents

NameDescription
 listList content of file or directory
 copyGenerate a copy of a file or of a directory
 moveMove a file or a directory to another place
 removeRemove file or directory (ignore call, if it does not exist)
 removeFileRemove file (ignore call, if it does not exist)
 createDirectoryCreate directory (if directory already exists, ignore call)
 existInquire whether file or directory exists
 assertNewTrigger an assert, if a file or directory exists
 fullPathNameGet full path name of file or directory name
 splitPathNameSplit path name in directory, file name kernel, file name extension
 temporaryFileNameReturn arbitrary name of a file that does not exist and is in a directory where access rights allow to write to this file (useful for temporary output of files)
 loadResourceReturn the absolute path name of a URI or local file name

Generated at 2024-12-23T19:25:42Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos