Provides a method to look for configuration and option files etc.
More...
#include <mitkStandardFileLocations.h>
|
void | AddDirectoryForSearch (const char *dir, bool insertInFrontOfSearchList=true) |
| Adds a directory into the search queue: \ Use this function in combination with FindFile(), after adding some \ directories, they will also be searched for the requested file. More...
|
|
void | RemoveDirectoryForSearch (const char *dir) |
| Remove a directory from the search queue: \ Use this function in combination with FindFile(). More...
|
|
std::string | FindFile (const char *filename, const char *pathInSourceDir=nullptr) |
| looks for a file in several standard locations More...
|
|
std::string | GetOptionDirectory () |
| Return directory of/for option files. More...
|
|
Provides a method to look for configuration and option files etc.
Call mitk::StandardFileLocations::FindFile(filename) to look for configuration files. Call mitk::StandardFileLocations::GetOptionDirectory() to look for/save option files.
Definition at line 29 of file mitkStandardFileLocations.h.
◆ FileSearchVectorType
◆ Pointer
◆ Self
◆ Superclass
◆ StandardFileLocations()
mitk::StandardFileLocations::StandardFileLocations |
( |
| ) |
|
|
protected |
◆ ~StandardFileLocations()
mitk::StandardFileLocations::~StandardFileLocations |
( |
| ) |
|
|
overrideprotected |
◆ AddDirectoryForSearch()
void mitk::StandardFileLocations::AddDirectoryForSearch |
( |
const char * |
dir, |
|
|
bool |
insertInFrontOfSearchList = true |
|
) |
| |
Adds a directory into the search queue: \ Use this function in combination with FindFile(), after adding some \ directories, they will also be searched for the requested file.
- Parameters
-
dir | directory you want to be searched in |
insertInFrontOfSearchList | whether this search request shall be processed first |
◆ Clone()
Pointer mitk::StandardFileLocations::Clone |
( |
| ) |
const |
|
protected |
◆ FindFile()
std::string mitk::StandardFileLocations::FindFile |
( |
const char * |
filename, |
|
|
const char * |
pathInSourceDir = nullptr |
|
) |
| |
looks for a file in several standard locations
- Parameters
-
filename | The file you want to fine, without any path |
pathInSourceDir | Where in the source tree hierarchy would that file be? |
- Returns
- The absolute path to the file including the filename
This method appends several standard locations to the end of the searchqueue (if they not already exist) and then searches for the file within all directories contained in the search queue:
-
Add the directory specified in the environment variable MITKCONF
-
Add the .mitk directory in the home folder of the user
-
Add the current working directory
-
Add the (current working directory)/bin directory
-
Add the directory specified in pathInSourceDir, that is relative to the source code directory root (which is determined at compile time)
Already added directories in the searchqueue by using AddDirectoryForSearch before calling FindFile are still searched first, because above mentioned standard locations are always appended at the end of the list.
◆ GetInstance()
◆ GetOptionDirectory()
std::string mitk::StandardFileLocations::GetOptionDirectory |
( |
| ) |
|
Return directory of/for option files.
- Returns
- The absolute path to the directory for option files.
This method looks for the directory of/for option files in two ways. The logic is as follows
- If there is an environment variable MITKOPTIONS, then use that directory.
- Use .mitk-subdirectory in home directory of the user
The directory will be created if it does not exist.
◆ New()
static Pointer mitk::StandardFileLocations::New |
( |
| ) |
|
|
staticprotected |
◆ RemoveDirectoryForSearch()
void mitk::StandardFileLocations::RemoveDirectoryForSearch |
( |
const char * |
dir | ) |
|
Remove a directory from the search queue: \ Use this function in combination with FindFile().
- Parameters
-
dir | directory you want to be searched in |
◆ SearchDirectoriesForFile()
std::string mitk::StandardFileLocations::SearchDirectoriesForFile |
( |
const char * |
filename | ) |
|
|
protected |
◆ m_SearchDirectories
The documentation for this class was generated from the following file: