#include <Base/QTCore/qSlicerUtils.h>
|
static QString | executableExtension () |
|
static QString | extractModuleNameFromClassName (const QString &className) |
|
static QString | extractModuleNameFromLibraryName (const QString &libraryName) |
| This function returns ".dll. on windows, ".so" on linux and ".dylib" on Mac. More...
|
|
static bool | isCLIExecutable (const QString &filePath) |
| Returns true if the filePath matches the CLI executable file name requirements. More...
|
|
static bool | isCLILoadableModule (const QString &filePath) |
|
static bool | isCLIScriptedExecutable (const QString &filePath) |
| Returns true if the filePath matches scripted CLI requirements. More...
|
|
static bool | isExecutableName (const QString &name) |
|
static bool | isLoadableModule (const QString &filePath) |
|
static bool | isPluginBuiltIn (const QString &filePath, const QString &applicationHomeDir) |
| Return true if the plugin identified with its filePath is a built-in Slicer module. More...
|
|
static bool | isPluginInstalled (const QString &filePath, const QString &applicationHomeDir) |
|
static bool | isTestingModule (qSlicerAbstractCoreModule *module) |
|
static bool | pathEndsWith (const QString &inputPath, const QString &path) |
| Return true if the inputPath ends with path. More...
|
|
static QString | pathWithoutIntDir (const QString &path, const QString &subDirWithoutIntDir) |
|
static QString | pathWithoutIntDir (const QString &path, const QString &subDirWithoutIntDir, QString &intDir) |
|
static QString | replaceWikiUrlVersion (const QString &text, const QString &version) |
| Return an updated text where Slicer wiki URL version is replaced with the provided one. More...
|
|
static QString | searchTargetInIntDir (const QString &directory, const QString &target) |
|
static bool | setPermissionsRecursively (const QString &path, QFile::Permissions directoryPermissions, QFile::Permissions filePermissions) |
|
Definition at line 31 of file qSlicerUtils.h.
◆ Self
◆ executableExtension()
static QString qSlicerUtils::executableExtension |
( |
| ) |
|
|
static |
This function returns an empty string on all plateform expected windows where it returns ".exe"
◆ extractModuleNameFromClassName()
static QString qSlicerUtils::extractModuleNameFromClassName |
( |
const QString & |
className | ) |
|
|
static |
Extract module name givew a className For example: qSlicerThresholdModule -> Threshold
◆ extractModuleNameFromLibraryName()
static QString qSlicerUtils::extractModuleNameFromLibraryName |
( |
const QString & |
libraryName | ) |
|
|
static |
This function returns ".dll. on windows, ".so" on linux and ".dylib" on Mac.
Extract module name given a library name For example: on linux, libThresholdLib.so -> Threshold on mac, libThresholdLib.{dylib, bundle, so} -> Threshold on windows, ThresholdLib.dll -> Threshold
◆ isCLIExecutable()
static bool qSlicerUtils::isCLIExecutable |
( |
const QString & |
filePath | ) |
|
|
static |
Returns true if the filePath matches the CLI executable file name requirements.
◆ isCLILoadableModule()
static bool qSlicerUtils::isCLILoadableModule |
( |
const QString & |
filePath | ) |
|
|
static |
Returns true if the filePath matches the CLI loadable module file name requirements.
- Note
- Associated fileName is expected to match the following regular expression: "(lib)?.+Lib\\.(dll|DLL|so|dylib)"
◆ isCLIScriptedExecutable()
static bool qSlicerUtils::isCLIScriptedExecutable |
( |
const QString & |
filePath | ) |
|
|
static |
Returns true if the filePath matches scripted CLI requirements.
◆ isExecutableName()
static bool qSlicerUtils::isExecutableName |
( |
const QString & |
name | ) |
|
|
static |
Return true if the string name ends with one of these executable extension: ".bat", ".com", ".sh", ".csh", ".tcsh", ".pl", ".py", ".tcl", ".m", ".exe"
- Note
- The comparison is case insensitive
◆ isLoadableModule()
static bool qSlicerUtils::isLoadableModule |
( |
const QString & |
filePath | ) |
|
|
static |
Return true if filePath matches the loadable module file name requirements.
- Note
- Associated fileName is expected to match the following regular expression: "(lib)?qSlicer.+Module\\.(so, dll, dylib)"
◆ isPluginBuiltIn()
static bool qSlicerUtils::isPluginBuiltIn |
( |
const QString & |
filePath, |
|
|
const QString & |
applicationHomeDir |
|
) |
| |
|
static |
Return true if the plugin identified with its filePath is a built-in Slicer module.
◆ isPluginInstalled()
static bool qSlicerUtils::isPluginInstalled |
( |
const QString & |
filePath, |
|
|
const QString & |
applicationHomeDir |
|
) |
| |
|
static |
Return true if the plugin identified with its filePath is loaded from an install tree.
- Warning
- Since internally the function looks for the existence of CMakeCache.txt, it will return an incorrect result if the plugin is installed in the build tree of an other project.
◆ isTestingModule()
Return true is the module is for testing purposes. These modules are for testing and for troubleshooting and normally should not be displayed to end users.
◆ pathEndsWith()
static bool qSlicerUtils::pathEndsWith |
( |
const QString & |
inputPath, |
|
|
const QString & |
path |
|
) |
| |
|
static |
Return true if the inputPath ends with path.
◆ pathWithoutIntDir() [1/2]
static QString qSlicerUtils::pathWithoutIntDir |
( |
const QString & |
path, |
|
|
const QString & |
subDirWithoutIntDir |
|
) |
| |
|
static |
Return the path without the intermediate directory or return path if there is no expected "IntDir". subDirWithoutIntDir corresponds to N last compononent of the path excluding the "IntDir".
Path | subDirWithoutIntDir | Return | IntDir |
/path/to/lib/module/Foo | lib/module | /path/to/lib/module | Foo |
/path/to/lib/module/Release | lib/module | /path/to/lib/module | Release |
/path/to/lib/module/Release/ | lib/module | /path/to/lib/module | Release |
/path/to/lib/module/Release | module | /path/to/lib/module | Release |
/path/to/lib/module/Release | (Empty string) | /path/to/lib/module/Release | (Empty string) |
/path/to/lib/module/Release/foo.txt | lib/module | /path/to/lib/module/Release/foo.txt | (Empty string) |
/path/to/lib/module/Release/foo.txt | lib/module/Release | /path/to/lib/module/Release | foo.txt |
/path/to/lib/module/Release | /path/to/lib/module | /path/to/lib/module | Release |
/path/to/bin | lib/module | /path/to/bin | (Empty string) |
/path/to/Foo.app/Contents/MacOSX | bin | /path/to/Foo.app/Contents/MacOSX | (Empty string) |
◆ pathWithoutIntDir() [2/2]
static QString qSlicerUtils::pathWithoutIntDir |
( |
const QString & |
path, |
|
|
const QString & |
subDirWithoutIntDir, |
|
|
QString & |
intDir |
|
) |
| |
|
static |
◆ replaceWikiUrlVersion()
static QString qSlicerUtils::replaceWikiUrlVersion |
( |
const QString & |
text, |
|
|
const QString & |
version |
|
) |
| |
|
static |
Return an updated text where Slicer wiki URL version is replaced with the provided one.
Any URL containing Documentation/<VERSION>/
will be updated.
More specifically, in an URL with http or https protocol that contains "Documentation" path element, the following path element is replaced by the provided version. If there are multiple "Documentation" path elements then only the first one is considered.
- Note
- The "path element" term is defined in this rfc: http://tools.ietf.org/html/rfc3986 "A path consists of a sequence of path segments separated by a slash
("/") character."
Examples:
QString input =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/SlicerToKiwiExporter";
QString expectedOutput =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.4/Extensions/SlicerToKiwiExporter";
input =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Foo/Extensions/SlicerToKiwiExporter";
expectedOutput =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Bar/Extensions/SlicerToKiwiExporter";
input =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Foo/Extensions/SlicerToKiwiExporter/Foo";
expectedOutput =
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Bar/Extensions/SlicerToKiwiExporter/Foo";
input =
"Read documentation at "
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.4/Extensions/SlicerToKiwiExporter."
"You will learn how to ...";
expectedOutput =
"Read documentation at "
"http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/SlicerToKiwiExporter."
"You will learn how to ...";
◆ searchTargetInIntDir()
static QString qSlicerUtils::searchTargetInIntDir |
( |
const QString & |
directory, |
|
|
const QString & |
target |
|
) |
| |
|
static |
Look for target file in build intermediate directory. On windows, the intermediate directory includes: . Debug RelWithDebInfo Release MinSizeRel And it return the first matched directory On the other plateform, this function just return the directory passed as a first argument
◆ setPermissionsRecursively()
static bool qSlicerUtils::setPermissionsRecursively |
( |
const QString & |
path, |
|
|
QFile::Permissions |
directoryPermissions, |
|
|
QFile::Permissions |
filePermissions |
|
) |
| |
|
static |
Set permissions of path. If path is a directory, permissions will be set to all its descendant. While recursively traversing the tree structure, if path or one of its descendant is a file, filePermissions will be set otherwise directoryPermissions will be set.
- Note
- If for some reason, permissions on a file or directory failed to be set, the traversing will be aborted and the permission already set won't be reverted.
- Returns
true
on success, false
otherwise.
- See also
- QFile::setPermissions()
The documentation for this class was generated from the following file: