Basic file handling operations. More...
#include <OpenMS/SYSTEM/File.h>
Static Public Member Functions | |
| static String | getExecutablePath () |
| static bool | exists (const String &file) |
Method used to test if a file exists. | |
| static bool | empty (const String &file) |
| Return true if the file does not exist or the file is empty. | |
| static bool | remove (const String &file) |
| Removes a file (if it exists). | |
| static bool | removeDirRecursively (const String &dir_name) |
| Removes the specified directory (absolute path). Returns true if successful. | |
| static String | absolutePath (const String &file) |
| Replaces the relative path in the argument with the absolute path. | |
| static String | basename (const String &file) |
| Returns the basename of the file (without the path). | |
| static String | path (const String &file) |
| Returns the path of the file (without the file name). | |
| static String | removeExtension (const String &file) |
| static bool | readable (const String &file) |
| Return true if the file exists and is readable. | |
| static bool | writable (const String &file) |
| Return true if the file is writable. | |
| static bool | isDirectory (const String &path) |
| Return true if the given path specifies a directory. | |
| static String | find (const String &filename, StringList directories=StringList()) |
Looks up the location of the file filename. | |
| static bool | fileList (const String &dir, const String &file_pattern, StringList &output, bool full_path=false) |
Retrieves a list of files matching file_pattern in directory dir (returns filenames without paths unless full_path is true). | |
| static String | getUniqueName () |
| Returns a string, consisting of date, time, hostname, process id, and a incrementing number. This can be used for temporary files. | |
| static String | getOpenMSDataPath () |
| Returns the OpenMS data path (environment variable overwrites the default installation path). | |
| static String | getTempDirectory () |
| The current OpenMS temporary data path (for temporary files). | |
| static String | getUserDirectory () |
| The current OpenMS user data path (for result files). | |
| static Param | getSystemParameters () |
| static String | findDatabase (const String &db_name) |
| static String | findExecutable (const String &toolName) |
| Searchs for an executable with the given name. | |
Static Private Member Functions | |
| static Param | getSystemParameterDefaults_ () |
| get defaults for the system's Temp-path, user home directory etc | |
| static bool | isOpenMSDataPath_ (const String &path) |
| Check if the given path is a valid OPENMS_DATA_PATH. | |
Friends | |
| class | TOPPBase |
Basic file handling operations.
Replaces the relative path in the argument with the absolute path.
Referenced by TOPPViewBase::addDataFile(), and TOPPViewBase::addRecentFile_().
Returns the basename of the file (without the path).
Referenced by TOPPViewBase::addDataFile(), TOPPASBase::addTOPPASFile(), DTAFile::load(), TOPPASBase::refreshParameters(), TOPPASBase::saveCurrentPipelineAs(), TOPPASBase::savePipeline(), TOPPASBase::savePipelineAs(), and INIFileEditorWindow::updateWindowTitle().
| static bool empty | ( | const String & | file | ) | [static] |
Return true if the file does not exist or the file is empty.
Referenced by SVMData::load().
| static bool exists | ( | const String & | file | ) | [static] |
Method used to test if a file exists.
Referenced by TOPPViewBase::addDataFile(), SVMData::load(), MS2File::load(), MascotInfile::load(), MascotGenericFile::load(), TOPPViewBase::loadPreferences(), TOPPASBase::loadPreferences(), TOPPASBase::openFilesInTOPPView(), TOPPASBase::TOPPASBase(), and TOPPViewBase::TOPPViewBase().
| static bool fileList | ( | const String & | dir, | |
| const String & | file_pattern, | |||
| StringList & | output, | |||
| bool | full_path = false | |||
| ) | [static] |
Retrieves a list of files matching file_pattern in directory dir (returns filenames without paths unless full_path is true).
| static String find | ( | const String & | filename, | |
| StringList | directories = StringList() | |||
| ) | [static] |
Looks up the location of the file filename.
The following locations are checked in this order:
directories | FileNotFound | is thrown, if the file is not found |
Referenced by MzMLHandler< MapType >::MzMLHandler().
uses File::find() to search for a file names db_name in the 'id_db_dir' param of the OpenMS system parameters
| FileNotFound | is thrown, if the file is not found |
Searchs for an executable with the given name.
| toolName | The executable to search for. |
| FileNotFound | is thrown, if the tool executable was not found. |
Referenced by TOPPASBase::openFilesInTOPPView().
| static String getExecutablePath | ( | ) | [static] |
Retrieve path of current executable (useful to find other TOPP tools) The returned path is either just an EMPTY string if the call to system subroutines failed or the complete path including a trailing "/", to enable usage of this function as File::getExecutablePath() + "mytool"
Referenced by TOPPASBase::openFilesInTOPPView().
| static String getOpenMSDataPath | ( | ) | [static] |
Returns the OpenMS data path (environment variable overwrites the default installation path).
Referenced by TOPPViewBase::openExampleDialog(), TOPPASBase::openExampleDialog(), TOPPASBase::TOPPASBase(), and TOPPViewBase::TOPPViewBase().
| static Param getSystemParameterDefaults_ | ( | ) | [static, private] |
get defaults for the system's Temp-path, user home directory etc
| static Param getSystemParameters | ( | ) | [static] |
get the system's default OpenMS.ini file in the users home directory (<home>/OpenMS/OpenMS.ini) or create/repair it if required
| static String getTempDirectory | ( | ) | [static] |
The current OpenMS temporary data path (for temporary files).
Referenced by TOPPASBase::TOPPASBase(), and TOPPASBase::~TOPPASBase().
| static String getUniqueName | ( | ) | [static] |
Returns a string, consisting of date, time, hostname, process id, and a incrementing number. This can be used for temporary files.
Referenced by TOPPViewBase::showTOPPDialog_(), and TOPPASBase::TOPPASBase().
| static bool isDirectory | ( | const String & | path | ) | [static] |
Return true if the given path specifies a directory.
| static bool isOpenMSDataPath_ | ( | const String & | path | ) | [static, private] |
Check if the given path is a valid OPENMS_DATA_PATH.
Returns the path of the file (without the file name).
Referenced by TOPPViewBase::updateCurrentPath(), and INIFileEditorWindow::updateWindowTitle().
| static bool readable | ( | const String & | file | ) | [static] |
Return true if the file exists and is readable.
Referenced by TOPPViewBase::finishTOPPToolExecution(), SVMData::load(), MS2File::load(), and INIFileEditorWindow::openFile().
| static bool remove | ( | const String & | file | ) | [static] |
Removes a file (if it exists).
Referenced by TOPPViewBase::finishTOPPToolExecution(), and TOPPViewBase::rerunTOPPTool().
| static bool removeDirRecursively | ( | const String & | dir_name | ) | [static] |
Removes the specified directory (absolute path). Returns true if successful.
Referenced by TOPPASBase::~TOPPASBase().
Returns the file name without the extension
The extension is the suffix of the string upto and including the last dot.
If no extension is found, the whole file name is returned
| static bool writable | ( | const String & | file | ) | [static] |
Return true if the file is writable.
Referenced by TOPPViewBase::runTOPPTool_(), TOPPViewBase::showTOPPDialog_(), and SVMData::store().
friend class TOPPBase [friend] |
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:56 using doxygen 1.7.1 |