Public Slots | |
FileManager methods | |
| QString | abbreviateFilename (const QString &filename, int length) |
| QString | absPath (const QString &filename, const QString ¤tDir) |
| bool | appendStringToFile (const QString &filename, const QString &string) |
| bool | appendStringToFileUTF8 (const QString &filename, const QString &string) |
| QString | cleanupPath (const QString &filename) |
| QStringList | contentOfDirectory (const QString &abspath, const QString &filter) |
| QStringList | contentOfDirectory (const QString &abspath) |
| bool | copy (const QString &src, const QString &dst) |
| bool | exists (const QString &filename) |
| QString | getCommonMeVisAppDataDir () |
| QDateTime | getCreationDate (const QString &filename) |
| QStringList | getDrives () |
| QString | getExecutable (const QString &name) |
| QString | getExecutableOnLocalMachine (const QString &name, const QString &bundleId=QString(), const QString &withinBundlePath=QString()) |
| uint | getFileSize (const QString &filename) |
| QString | getHomeDir () |
| QDateTime | getLastModifiedDate (const QString &filename) |
| QDateTime | getLastReadDate (const QString &filename) |
| QString | getLocalApplicationSupportDirectory (const QString &appName=QString()) |
| QString | getTmpDir () |
| QString | getUniqueFilename (const QString &path, const QString &prefix, const QString &postfix) |
| QString | getUserApplicationSupportDirectory (const QString &appName=QString()) |
| bool | isDir (const QString &filename) |
| bool | isReadable (const QString &filename) |
| bool | isWritable (const QString &filename) |
| QString | macGetApplicationForId (const QString &id) |
| QString | macGetBundleDir (const QString &id=QString()) |
| QString | macGetBundleExecutable (const QString &bundlename) |
| QString | macGetBundleResourcesDir () |
| QString | macGetBundleSharedSupportDir () |
| bool | macIsApplicationBundle (const QString &filename) |
| bool | mkdir (const QString &abspath) |
| bool | moveFileToTrash (const QString &filename) |
| QString | nativePath (const QString &filename) |
| QString | normalizePath (const QString &filename) |
| QString | readStringFromFile (const QString &filename) |
| QString | readStringFromFileUTF8 (const QString &filename) |
| QStringList | recursiveContentOfDirectory (const QString &abspath) |
| QStringList | recursiveContentOfDirectory (const QString &abspath, const QString &filter) |
| bool | recursiveRemoveDir (const QString &abspath) |
| bool | remove (const QString &filename) |
| bool | rename (const QString &filename, const QString &newfilename) |
| bool | rmdir (const QString &abspath) |
| QMap< QString, QVariant > | splitPath (const QString &abspath) |
| bool | writeStringToFile (const QString &filename, const QString &string) |
| bool | writeStringToFileUTF8 (const QString &filename, const QString &string) |
The MLABFileManager can be used to access the local file system. It can:
| QString MLABFileManager::abbreviateFilename | ( | const QString & | filename, | |
| int | length | |||
| ) | [slot] |
abbreviate 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)
| QString MLABFileManager::absPath | ( | const QString & | filename, | |
| const QString & | currentDir | |||
| ) | [slot] |
makes the given path absolute if it is relative (by using the currentDir)
| bool MLABFileManager::appendStringToFile | ( | const QString & | filename, | |
| const QString & | string | |||
| ) | [slot] |
append string to a file (latin1 encoded)
| bool MLABFileManager::appendStringToFileUTF8 | ( | const QString & | filename, | |
| const QString & | string | |||
| ) | [slot] |
append string to a file (UTF8 unicode encoded)
| QString MLABFileManager::cleanupPath | ( | const QString & | filename | ) | [slot] |
normalize the path to contain "/" forward slashes only and removes ".."
| QStringList MLABFileManager::contentOfDirectory | ( | const QString & | abspath, | |
| const QString & | filter | |||
| ) | [slot] |
get string list with content of the given directory filtered with the given filter (this is not recursive and contains directories, files and symlinks)
The filter can contain any number of filters separated by " " or ";". Example: "*.cpp *.h" will return cpp and h files
The returned strings contain the filenames only, not the full file paths (as opposed to ILab4, where full paths were returned).
| QStringList MLABFileManager::contentOfDirectory | ( | const QString & | abspath | ) | [slot] |
get string list with content of the given directory (this is not recursive and contains directories, files and symlinks)
The returned strings contain the filenames only, not the full file paths (as opposed to MLAB4, where full paths were returned).
| bool MLABFileManager::copy | ( | const QString & | src, | |
| const QString & | dst | |||
| ) | [slot] |
copy a file (not a directory!) (returns true if ok)
| bool MLABFileManager::exists | ( | const QString & | filename | ) | [slot] |
return if file exists
| QString MLABFileManager::getCommonMeVisAppDataDir | ( | ) | [slot] |
get the directory that is common to all mevis applications for sharing their settings
| QDateTime MLABFileManager::getCreationDate | ( | const QString & | filename | ) | [slot] |
get creation date/time of file
| QStringList MLABFileManager::getDrives | ( | ) | [slot] |
returns a list of available drives on windows, on unix just returns "/" (root)
| QString MLABFileManager::getExecutable | ( | const QString & | name | ) | [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). On Mac OS X it also locates application bundles with the same name in the packages bin directories and some known default locations within MeVisLab and if found returns the main executable of that bundle. It does NOT try to locate the executable outside of the MeVisLab installation.
| QString MLABFileManager::getExecutableOnLocalMachine | ( | const QString & | name, | |
| const QString & | bundleId = QString(), |
|||
| const QString & | withinBundlePath = QString() | |||
| ) | [slot] |
get 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. On Mac OS X you may also pass a bundle id and relative path within the bundle to the directory in which the executable is found. If no relative path within the bundle is given, the function tries some standard locations.
| uint MLABFileManager::getFileSize | ( | const QString & | filename | ) | [slot] |
get size of file
| QString MLABFileManager::getHomeDir | ( | ) | [slot] |
get the users home dir
| QDateTime MLABFileManager::getLastModifiedDate | ( | const QString & | filename | ) | [slot] |
get last modified date/time of file
| QDateTime MLABFileManager::getLastReadDate | ( | const QString & | filename | ) | [slot] |
get last read date/time of file
| QString MLABFileManager::getLocalApplicationSupportDirectory | ( | const QString & | appName = QString() |
) | [slot] |
get 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() ).
| QString MLABFileManager::getTmpDir | ( | ) | [slot] |
get the path to the temporary directory (uses TEMP or TMP env vars, falls back to /tmp on Mac OS X or Linux
| QString MLABFileManager::getUniqueFilename | ( | const QString & | path, | |
| const QString & | prefix, | |||
| const QString & | postfix | |||
| ) | [slot] |
create 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.
var file = MLABFileManager.getUniqueFilename(MLABFileManager.getTmpDir(), "test",".tif")
| QString MLABFileManager::getUserApplicationSupportDirectory | ( | const QString & | appName = QString() |
) | [slot] |
get 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.
| bool MLABFileManager::isDir | ( | const QString & | filename | ) | [slot] |
return if file is a directory
| bool MLABFileManager::isReadable | ( | const QString & | filename | ) | [slot] |
returns if file is readable
| bool MLABFileManager::isWritable | ( | const QString & | filename | ) | [slot] |
returns if file is writable
| QString MLABFileManager::macGetApplicationForId | ( | const QString & | id | ) | [slot] |
get directory of application bundle with given application id (Mac OS X only)
| QString MLABFileManager::macGetBundleDir | ( | const QString & | id = QString() |
) | [slot] |
get absolute path to the bundle directory of bundle with the given id or the current application if no id is given (Mac OS X only)
| QString MLABFileManager::macGetBundleExecutable | ( | const QString & | bundlename | ) | [slot] |
get absolute path of the main executable in the given application bundle (Mac OS X only)
| QString MLABFileManager::macGetBundleResourcesDir | ( | ) | [slot] |
get directory of the application resources within the application bundle (Mac OS X only)
| QString MLABFileManager::macGetBundleSharedSupportDir | ( | ) | [slot] |
get directory of the application shared support within the application bundle (Mac OS X only)
| bool MLABFileManager::macIsApplicationBundle | ( | const QString & | filename | ) | [slot] |
returns 'true', if file is an application bundle (Mac OS X only)
| bool MLABFileManager::mkdir | ( | const QString & | abspath | ) | [slot] |
creates a deep directory (returns true if ok)
| bool MLABFileManager::moveFileToTrash | ( | const QString & | filename | ) | [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
| QString MLABFileManager::nativePath | ( | const QString & | filename | ) | [slot] |
converts slashes to system default "\" on Windows, "/" on Mac OS X or Linux
| QString MLABFileManager::normalizePath | ( | const QString & | filename | ) | [slot] |
normalize the path to contain "/" forward slashes only
| QString MLABFileManager::readStringFromFile | ( | const QString & | filename | ) | [slot] |
get file as string (latin1 encoded) (is empty when read fails)
| QString MLABFileManager::readStringFromFileUTF8 | ( | const QString & | filename | ) | [slot] |
get file as string (UTF8 unicode encoded) (is empty when read fails)
| QStringList MLABFileManager::recursiveContentOfDirectory | ( | const QString & | abspath | ) | [slot] |
get string list with content of the given directory (this is not recursive and contains directories, files and symlinks)
The returned strings contain the filenames only, not the full file paths (as opposed to MLAB4, where full paths were returned).
| QStringList MLABFileManager::recursiveContentOfDirectory | ( | const QString & | abspath, | |
| const QString & | filter | |||
| ) | [slot] |
get string list with content of the given directory (this is not recursive and contains directories, files and symlinks)
The returned strings contain the filenames only, not the full file paths (as opposed to MLAB4, where full paths were returned).
| bool MLABFileManager::recursiveRemoveDir | ( | const QString & | abspath | ) | [slot] |
removes a directory and all its content recursively (returns true if ok)
| bool MLABFileManager::remove | ( | const QString & | filename | ) | [slot] |
remove a given file (returns true if ok)
| bool MLABFileManager::rename | ( | const QString & | filename, | |
| const QString & | newfilename | |||
| ) | [slot] |
rename a given file (returns true if ok)
| bool MLABFileManager::rmdir | ( | const QString & | abspath | ) | [slot] |
removes a directory (returns true if ok, directory must be empty)
| QMap<QString, QVariant> MLABFileManager::splitPath | ( | const QString & | abspath | ) | [slot] |
Obtain directory, filename, basename and extension portions of path.
The returned object has the properties
| bool MLABFileManager::writeStringToFile | ( | const QString & | filename, | |
| const QString & | string | |||
| ) | [slot] |
write string to a file (latin1 encoded)
| bool MLABFileManager::writeStringToFileUTF8 | ( | const QString & | filename, | |
| const QString & | string | |||
| ) | [slot] |
write string to a file (UTF8 unicode encoded)
1.5.8