Modelica.Utilities.Internal.FileSystem

Internal package with external functions as interface to the file system

Information


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).

Package Content

NameDescription
Modelica.Utilities.Internal.FileSystem.mkdir mkdir Make directory (POSIX: 'mkdir')
Modelica.Utilities.Internal.FileSystem.rmdir rmdir Remove empty directory (POSIX function 'rmdir')
Modelica.Utilities.Internal.FileSystem.stat stat Inquire file information (POSIX function 'stat')
Modelica.Utilities.Internal.FileSystem.rename rename Rename existing file or directory (C function 'rename')
Modelica.Utilities.Internal.FileSystem.removeFile removeFile Remove existing file (C function 'remove')
Modelica.Utilities.Internal.FileSystem.copyFile copyFile Copy existing file (C functions 'fopen', 'getc', 'putc', 'fclose')
Modelica.Utilities.Internal.FileSystem.readDirectory readDirectory Read names of a directory (POSIX functions opendir, readdir, closedir)
Modelica.Utilities.Internal.FileSystem.getNumberOfFiles getNumberOfFiles Get number of files and directories in a directory (POSIX functions opendir, readdir, closedir)


Modelica.Utilities.Internal.FileSystem.mkdir Modelica.Utilities.Internal.FileSystem.mkdir

Make directory (POSIX: 'mkdir')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringdirectoryName Make a new directory

Modelica definition

function mkdir "Make directory (POSIX: 'mkdir')"
  extends Modelica.Icons.Function;
  input String directoryName "Make a new directory";
external "C" ModelicaInternal_mkdir(directoryName);

end mkdir;

Modelica.Utilities.Internal.FileSystem.rmdir Modelica.Utilities.Internal.FileSystem.rmdir

Remove empty directory (POSIX function 'rmdir')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringdirectoryName Empty directory to be removed

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.stat Modelica.Utilities.Internal.FileSystem.stat

Inquire file information (POSIX function 'stat')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Stringname Name of file, directory, pipe etc.

Outputs

TypeNameDescription
FileTypefileTypeType of file

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.rename Modelica.Utilities.Internal.FileSystem.rename

Rename existing file or directory (C function 'rename')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringoldName Current name
StringnewName New name

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.removeFile Modelica.Utilities.Internal.FileSystem.removeFile

Remove existing file (C function 'remove')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfileName File to be removed

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.copyFile Modelica.Utilities.Internal.FileSystem.copyFile

Copy existing file (C functions 'fopen', 'getc', 'putc', 'fclose')

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
StringfromName Name of file to be copied
StringtoName Name of copy of file

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.readDirectory Modelica.Utilities.Internal.FileSystem.readDirectory

Read names of a directory (POSIX functions opendir, readdir, closedir)

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Stringdirectory Name of the directory from which information is desired
IntegernNames Number of names that are returned (inquire with getNumberOfFiles)

Outputs

TypeNameDescription
Stringnames[nNames]All file and directory names in any order from the desired directory

Modelica definition

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;

Modelica.Utilities.Internal.FileSystem.getNumberOfFiles Modelica.Utilities.Internal.FileSystem.getNumberOfFiles

Get number of files and directories in a directory (POSIX functions opendir, readdir, closedir)

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Stringdirectory Directory name

Outputs

TypeNameDescription
IntegerresultNumber of files and directories present in 'directory'

Modelica definition

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;

Automatically generated Fri Nov 12 16:31:49 2010.