main
bool fileExists = filesystem.file exists "image.png"
if ( fileExists )
print "File found."
else
print "File not found."
This class contains filesystem specific methods.
The paths may have "/" or "\" as separator characters. These are converted to separator characters that are supported by the native filesystem. If the path has several adjoining separators, these are combined to one separator.
Wildcards or references to parent directory using ".." are not supported
Resource files are copied from the project's "Resource Files" directory to the installation package. These files can be accessed using pathnames relative to the Resource Files directory. The filename may have optional separator character at the beginning of the filename.
Check file's existence.
main
bool fileExists = filesystem.file exists "image.png"
if ( fileExists )
print "File found."
else
print "File not found."
Check directory's existence.
main
bool dirExists = filesystem.directory exists "images\"
if ( dirExists )
print "Directory found."
else
print "directory not found."
Removes a file.
main
try
filesystem.remove file "images\image.png"
catch IOException e
print "File could not be removed"
return
print "File removed."
Removes a directory.
main
try
filesystem.remove directory "images\"
catch IOException e
print "Directory could not be removed."
return
print "Directory removed."
Lists all sub-directories of the specified directory.
main
String[] directories
try
directories = filesystem.list directories from "images\"
catch IOException e
print "Directories could not be listed."
return
print "Directory listing:"
i = 0
while ( i < directories.get size )
print directories[i]
i++
Lists all files of the specified directory.
main
String[] files
try
files = filesystem.list files from "images\"
catch IOException e
print "Files could not be listed."
return
print "File listing:"
i = 0
while ( i < files.get size )
print files[i]
i++
Creates a file. The file content is truncated if the file already exists.
main
try
filesystem.create file "images\picture.jpg"
catch IOException e
print "File could not be created."
return
print "File created."
Creates a directory if does not exist.
main
try
filesystem.create directory "images\newImages\"
catch IOException e
print "Directory could not be created."
return
print "Directory created."
Moves a file from fromPath to toPath.
main
try
filesystem.move file "image.png" to "images\newImages\"
catch IOException e
print "File could not be moved."
return
print "File move successful."
Moves a directory from fromPath to toPath. Note that the target directory should not exist beforehand. If you want to move the the directory to the already existing directory you should specify a non existing sub-directory for it.
main
try
filesystem.move directory "tempImages\" to "images\newImages\"
catch IOException e
print "Directory could not be moved."
return
print "Directory moved successfully."