Package Internal.FileSystem is an internal package that contains low level functions as interface to the file system. These functions should not be called directly in a scripting environment since more convenient functions are provided in packages Files and Systems.
Note, the functions in this package are direct interfaces to functions of POSIX and of the standard C library. Errors occuring in these functions are treated by triggering a Modelica assert. Therefore, the functions in this package return only for a successful operation. Furthermore, the representation of a string is hidden by this interface, especially if the operating system supports Unicode characters.
Extends from Modelica.Icons.Package (Icon for standard packages).
Name | Description |
---|---|
mkdir | Make directory (POSIX: 'mkdir') |
rmdir | Remove empty directory (POSIX function 'rmdir') |
stat | Inquire file information (POSIX function 'stat') |
rename | Rename existing file or directory (C function 'rename') |
removeFile | Remove existing file (C function 'remove') |
copyFile | Copy existing file (C functions 'fopen', 'getc', 'putc', 'fclose') |
readDirectory | Read names of a directory (POSIX functions opendir, readdir, closedir) |
getNumberOfFiles | Get number of files and directories in a directory (POSIX functions opendir, readdir, closedir) |
Type | Name | Default | Description |
---|---|---|---|
String | directoryName | Make a new directory |
function mkdir "Make directory (POSIX: 'mkdir')" extends Modelica.Icons.Function; input String directoryName "Make a new directory"; external "C" ModelicaInternal_mkdir(directoryName);end mkdir;
Type | Name | Default | Description |
---|---|---|---|
String | directoryName | Empty directory to be removed |
function rmdir "Remove empty directory (POSIX function 'rmdir')" extends Modelica.Icons.Function; input String directoryName "Empty directory to be removed"; external "C" ModelicaInternal_rmdir(directoryName);end rmdir;
Type | Name | Default | Description |
---|---|---|---|
String | name | Name of file, directory, pipe etc. |
Type | Name | Description |
---|---|---|
FileType | fileType | Type of file |
function stat "Inquire file information (POSIX function 'stat')" extends Modelica.Icons.Function; input String name "Name of file, directory, pipe etc."; output Types.FileType fileType "Type of file"; external "C" fileType = ModelicaInternal_stat(name);end stat;
Type | Name | Default | Description |
---|---|---|---|
String | oldName | Current name | |
String | newName | New name |
function rename "Rename existing file or directory (C function 'rename')" extends Modelica.Icons.Function; input String oldName "Current name"; input String newName "New name"; external "C" ModelicaInternal_rename(oldName, newName);end rename;
Type | Name | Default | Description |
---|---|---|---|
String | fileName | File to be removed |
function removeFile "Remove existing file (C function 'remove')" extends Modelica.Icons.Function; input String fileName "File to be removed"; external "C" ModelicaInternal_removeFile(fileName);end removeFile;
Type | Name | Default | Description |
---|---|---|---|
String | fromName | Name of file to be copied | |
String | toName | Name of copy of file |
function copyFile "Copy existing file (C functions 'fopen', 'getc', 'putc', 'fclose')" extends Modelica.Icons.Function; input String fromName "Name of file to be copied"; input String toName "Name of copy of file"; external "C" ModelicaInternal_copyFile(fromName, toName);end copyFile;
Type | Name | Default | Description |
---|---|---|---|
String | directory | Name of the directory from which information is desired | |
Integer | nNames | Number of names that are returned (inquire with getNumberOfFiles) |
Type | Name | Description |
---|---|---|
String | names[nNames] | All file and directory names in any order from the desired directory |
function readDirectory "Read names of a directory (POSIX functions opendir, readdir, closedir)" extends Modelica.Icons.Function; input String directory "Name of the directory from which information is desired"; input Integer nNames "Number of names that are returned (inquire with getNumberOfFiles)"; output String names[nNames] "All file and directory names in any order from the desired directory"; external "C" ModelicaInternal_readDirectory(directory,nNames,names);end readDirectory;
Type | Name | Default | Description |
---|---|---|---|
String | directory | Directory name |
Type | Name | Description |
---|---|---|
Integer | result | Number of files and directories present in 'directory' |
function getNumberOfFiles "Get number of files and directories in a directory (POSIX functions opendir, readdir, closedir)" extends Modelica.Icons.Function; input String directory "Directory name"; output Integer result "Number of files and directories present in 'directory'"; external "C" result = ModelicaInternal_getNumberOfFiles(directory);end getNumberOfFiles;