MeVisLab Scripting Reference
|
#include <mlabScriptWrappers.h>
Inherits QObject.
Public Slots | |
FileManager methods | |
| |
QString | readStringFromFile (const QString &filename) |
bool | writeStringToFile (const QString &filename, const QString &string) |
bool | appendStringToFile (const QString &filename, const QString &string) |
QString | readStringFromFileUTF8 (const QString &filename) |
bool | writeStringToFileUTF8 (const QString &filename, const QString &string) |
bool | appendStringToFileUTF8 (const QString &filename, const QString &string) |
bool | mkdir (const QString &path) |
bool | rmdir (const QString &path) |
bool | recursiveRemoveDir (const QString &path) |
bool | remove (const QString &filename) |
bool | moveFileToTrash (const QString &filename) |
bool | rename (const QString &filename, const QString &newfilename) |
bool | copy (const QString &src, const QString &dst) |
bool | exists (const QString &filename) |
bool | isDir (const QString &filename) |
bool | isReadable (const QString &filename) |
bool | isWritable (const QString &filename) |
QString | getTmpDir () |
QString | getHomeDir () |
QString | getExecutable (const QString &name) |
QString | getExecutableOnLocalMachine (const QString &name) |
QString | getCommonMeVisAppDataDir () |
void | setApplicationSupportUmbrellaDirectoryName (const QString &dirName) |
QString | getLocalApplicationSupportDirectory (const QString &appName=QString()) |
QString | getUserApplicationSupportDirectory (const QString &appName=QString()) |
QString | getLocalApplicationCachesDirectory (const QString &appName=QString()) |
QString | getUserApplicationCachesDirectory (const QString &appName=QString()) |
QStringList | getDrives () |
uint | getFileSize (const QString &filename) |
QDateTime | getCreationDate (const QString &filename) |
QDateTime | getLastModifiedDate (const QString &filename) |
QDateTime | getLastReadDate (const QString &filename) |
QString | normalizePath (const QString &filename) |
QString | cleanupPath (const QString &filename) |
QString | nativePath (const QString &filename) |
QStringList | contentOfDirectory (const QString &path) |
QStringList | contentOfDirectory (const QString &path, const QString &filter) |
QStringList | recursiveContentOfDirectory (const QString &path, const QString &filter) |
QStringList | recursiveContentOfDirectory (const QString &path) |
QMap< QString, QVariant > | splitPath (const QString &path) |
QString | abbreviateFilename (const QString &filename, int length) |
QString | absPath (const QString &filename, const QString ¤tDir) |
QString | getUniqueFilename (const QString &path, const QString &prefix, const QString &postfix) |
bool | isPathInside (const QString &path, const QString &containerPath) |
quint64 | diskCapacity (const QString &path) |
quint64 | availableDiskSpace (const QString &path) |
Global MLABFileManager object available in all scripts.
The MLABFileManager can be used to access the local file system. It can:
|
slot |
Abbreviates the filename so that drive and filename are still visible (length is only a hint, the string might be longer because the full filename will be visible).
|
slot |
Makes the given path absolute if it is relative (by using the currentDir).
|
slot |
Appends string to a file (UTF-8 encoded).
|
slot |
Appends a string to a file (UTF-8 ncoded).
|
slot |
Returns the available space of the disk on which the given path exists in bytes.
|
slot |
Normalizes the path to contain "/" forward slashes only and removes "..".
|
slot |
Returns a string list with content of the given directory.
The method does not search recursively and returns directories and files. The returned strings contain filenames relative to path
. NOTE: This does not list hidden nor system files.
|
slot |
Returns a string list with content of the given directory filtered with the given filter.
The method does not search recursively and returns files (not directories) that match the filter. The returned strings contain filenames relative to path
. NOTE: This does not list hidden nor system files.
The filter can contain any number of filters separated by " " or ";". Example: "*.cpp *.h" will return cpp and h files
|
slot |
Copies a file (not a directory!) (returns true if OK).
|
slot |
Returns the capacity of the disk on which the given path exists in bytes.
|
slot |
Returns whether file exists.
|
slot |
Returns the directory that is common to all MeVis applications for sharing their settings.
|
slot |
Returns the creation date/time of the file.
|
slot |
Returns a list of available drives on Windows, on Unix just returns "/" (root).
|
slot |
Returns the absolute path of the given executable (where name is given without debug and file extension).
The executable is searched in all MeVisLab packages (in the bin directories). It does NOT try to locate the executable outside of the MeVisLab installation.
|
slot |
Returns the absolute path to an executable located somewhere on the user's computer: the executable's name is given without any extension.
First, the function tries to locate the executable within MeVisLab and then on the whole system. Each platform may try a different approach to locate the executable.
|
slot |
Returns the size of the file.
|
slot |
Returns the users home dir.
|
slot |
Returns the last modified date/time of the file.
|
slot |
Returns the last read date/time of the file.
|
slot |
Returns the absolute path to the directory in which to store discardable cache files available to everyone on this machine.
If the appName argument is provided, use the caches directory with the given name. Otherwise the caches directory of the current, calling application is returned.
|
slot |
Returns the absolute path to the directory in which to store application support data available to everyone on this machine.
If the appName argument is provided, use the application support directory with the given name. Otherwise the application support directory of the current, calling application is returned (This should be the same value as returned by getCommonMeVisAppDataDir() ).
|
slot |
Returns the path to the temporary directory (uses TEMP or TMP environment vars, falls back to /tmp on Linux.
|
slot |
Creates a unique filename of the form path + prefix + uniqueNumber + postfix, which is guaranteed to be non existent.
Unique numbers start from 0 until a non existent file is found. If the path does not exist, an empty string is returned.
|
slot |
Returns the absolute path to the directory in which to store discardable cache files available to the current user.
If the appName argument is provided, use the caches directory with the given name. Otherwise the caches directory of the current, calling application is returned.
|
slot |
Returns the absolute path to the directory in which to store application support data available to the current user.
If the appName argument is provided, use the application support directory with the given name. Otherwise the application support directory of the current, calling application is returned.
|
slot |
Returns whether file is a directory.
|
slot |
Returns whether path is contained inside containerPath.
The check is performed with and without resolving symbolic links.
|
slot |
Returns whether file is readable.
|
slot |
Returns whether file is writable.
|
slot |
Creates a deep directory (returns true if OK).
|
slot |
File is moved to the trash folder on supported systems, otherwise the file is removed (returns true if OK).
This function is useful in all cases where the file represents a user document or a file that may be open and still required by the system, e.g. a dynamic library.
|
slot |
Converts slashes to system default "\" on Windows, "/" on Linux.
|
slot |
Normalizes the path to contain "/" forward slashes only.
|
slot |
Returns file const as a string (assumes UTF-8 encoding, falls back to Latin1 in case of decoding errors) .
Return value is empty when read fails.
|
slot |
Returns file content as a string (uses UTF-8 encoding, faulty characters removed/replaced).
Return value is empty when read fails.
|
slot |
Returns a string list with recursive content of the given directory.
The method searches recursively and returns directories and files. NOTE: This does not list hidden nor system files. The returned strings contain filenames relative to path
.
|
slot |
Returns a string list with recursive content of the given directory.
The method searches recursively and returns files (not directories) that match the filter. The returned strings contain filenames relative to path
. NOTE: This does not list hidden nor system files.
The filter can contain any number of filters separated by " " or ";". Example: "*.cpp *.h" will return cpp and h files
|
slot |
Removes a directory and all its content recursively (returns true if OK).
|
slot |
Removes a given file (returns true if OK).
|
slot |
Renames a given file (returns true if OK).
|
slot |
Removes a directory (returns true if ok, directory must be empty).
|
slot |
Set the name of a folder that contains the support data directories of all MeVisLab applications. No such folder is created/used if empty.
Default: 'MeVis'.
|
slot |
Obtains the directory, filename, basename, and extension portions of path.
The returned object has the properties
|
slot |
Writes a string to a file (UTF-8 encoded).
|
slot |
Writes a string to a file (UTF-8 encoded).