12 #include <OpenMS/config.h>
310 static void download(
const std::string& url,
const std::string& download_folder);
320 #ifdef OPENMS_WINDOWSPLATFORM
331 static StringList executableExtensions_(
const String& ext = std::getenv(
"PATHEXT"));
Class representing a temporary directory.
Definition: File.h:39
TempDir & operator=(TempDir &&)=delete
TempDir & operator=(const TempDir &)=delete
String temp_dir_
Definition: File.h:59
~TempDir()
Destroy temporary folder (can be prohibited in Constructor)
TempDir(bool keep_dir=false)
TempDir(const TempDir &)=delete
delete all means to copy or move a TempDir
TempDir(TempDir &&)=delete
const String & getPath() const
Return path to temporary folder.
bool keep_dir_
Definition: File.h:60
Internal helper class, which holds temporary filenames and deletes these files at program exit.
Definition: File.h:338
StringList filenames_
Definition: File.h:348
String newFile()
create a new filename and queue internally for deletion
TemporaryFiles_(const TemporaryFiles_ &)=delete
std::mutex mtx_
Definition: File.h:349
TemporaryFiles_ & operator=(const TemporaryFiles_ &)=delete
Basic file handling operations.
Definition: File.h:28
static bool removeDirRecursively(const String &dir_name)
Removes the subdirectories of the specified directory (absolute path). Returns true if successful.
static String getOpenMSHomePath()
Returns the OpenMS home path (environment variable overwrites the default home path)
static bool exists(const String &file)
Method used to test if a file exists.
static bool copyDirRecursively(const QString &from_dir, const QString &to_dir, File::CopyOptions option=CopyOptions::OVERWRITE)
static bool validateMatchingFileNames(const StringList &sl1, const StringList &sl2, bool basename=true, bool ignore_extension=true, bool strict=false)
Helper function to test if filenames provided in two StringLists match.
static String getExecutablePath()
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 unl...
static bool executable(const String &file)
Method used to test if a file is executable.
static String getOpenMSDataPath()
Returns the OpenMS data path (environment variable overwrites the default installation path)
CopyOptions
Copy directory recursively.
Definition: File.h:113
static Param getSystemParameterDefaults_()
get defaults for the system's Temp-path, user home directory etc.
static String findDoc(const String &filename)
Resolves a partial file name to a documentation file in the doc-folder.
static String path(const String &file)
static String getUserDirectory()
static String findSiblingTOPPExecutable(const String &toolName)
Searches for an executable with the given name.
static String absolutePath(const String &file)
Replaces the relative path in the argument with the absolute path.
static String basename(const String &file)
static String getUniqueName(bool include_hostname=true)
Returns a string, consisting of date, time, hostname, process id, and a incrementing number....
static bool writable(const String &file)
Return true if the file is writable.
static UInt64 fileSize(const String &file)
The filesize in bytes (or -1 on error, e.g. if the file does not exist)
static bool remove(const String &file)
Removes a file (if it exists).
static String getTemporaryFile(const String &alternative_file="")
Obtain a temporary filename, ensuring automatic deletion upon exit.
static String find(const String &filename, StringList directories=StringList())
Looks up the location of the file filename.
static String getTempDirectory()
static String findDatabase(const String &db_name)
static StringList getPathLocations(const String &path=std::getenv("PATH"))
Extract list of directories from a concatenated string (usually $PATH).
static bool findExecutable(OpenMS::String &exe_filename)
Searches for an executable with the given name (similar to where (Windows) or which (Linux/MacOS)
static bool readable(const String &file)
Return true if the file exists and is readable.
static bool isOpenMSDataPath_(const String &path)
Check if the given path is a valid OPENMS_DATA_PATH.
static void download(const std::string &url, const std::string &download_folder)
Download file from given URL into a download folder. Returns when done. Throws FileNotFound exception...
static Param getSystemParameters()
static TemporaryFiles_ temporary_files_
private list of temporary filenames, which are deleted upon program exit
Definition: File.h:354
static bool isDirectory(const String &path)
Return true if the given path specifies a directory.
static bool removeDir(const QString &dir_name)
Removes the directory and all subdirectories (absolute path).
static bool empty(const String &file)
Return true if the file does not exist or the file is empty.
static bool rename(const String &from, const String &to, bool overwrite_existing=true, bool verbose=true)
Rename a file.
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
Base class for TOPP applications.
Definition: TOPPBase.h:122
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:51
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
int verbose
Verbosity level ( "-v" is 1 and "-V" is 2 )
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22