OpenMS
Loading...
Searching...
No Matches
SystemSettings Class Reference

Per-user OpenMS configuration: the OpenMS.ini system parameters and the home, temporary and database directories derived from them. More...

#include <OpenMS/SYSTEM/SystemSettings.h>

Static Public Member Functions

static std::string getOpenMSHomePath ()
 Returns the OpenMS home path (environment variable overwrites the default home path)
 
static std::string getOpenMSConfigDir ()
 Returns the per-user OpenMS configuration directory (the directory that holds OpenMS.ini)
 
static std::string getTempDirectory ()
 
static std::string getUserDirectory ()
 
static Param getSystemParameters ()
 
static std::string findDatabase (const std::string &db_name)
 

Static Private Member Functions

static Param getSystemParameterDefaults_ ()
 get defaults for the system's Temp-path, user home directory etc.
 

Detailed Description

Per-user OpenMS configuration: the OpenMS.ini system parameters and the home, temporary and database directories derived from them.

Every lookup honours the environment overrides (OPENMS_HOME_PATH, OPENMS_TMPDIR, XDG_CONFIG_HOME) before consulting OpenMS.ini and the platform defaults.

This class depends on File and Param; File does not depend on it. These lookups used to be static members of File.

Member Function Documentation

◆ findDatabase()

static std::string findDatabase ( const std::string &  db_name)
static

uses File::find() to search for a file names db_name in the 'id_db_dir' param of the OpenMS system parameters

Exceptions
FileNotFoundis thrown, if the file is not found

◆ getOpenMSConfigDir()

static std::string getOpenMSConfigDir ( )
static

Returns the per-user OpenMS configuration directory (the directory that holds OpenMS.ini)

Follows the XDG base directory specification on unix-like systems (<XDG_CONFIG_HOME>/OpenMS or <home>/.config/OpenMS) and uses <home>/.OpenMS otherwise. The returned path has no trailing separator and the directory is not guaranteed to exist.

Returns
String containing the per-user OpenMS configuration directory path

◆ getOpenMSHomePath()

static std::string getOpenMSHomePath ( )
static

Returns the OpenMS home path (environment variable overwrites the default home path)

◆ getSystemParameterDefaults_()

static Param getSystemParameterDefaults_ ( )
staticprivate

get defaults for the system's Temp-path, user home directory etc.

◆ getSystemParameters()

static Param getSystemParameters ( )
static

Returns the OpenMS.ini system parameters, read from getOpenMSConfigDir() + "/OpenMS.ini". The file is optional and never written by OpenMS. Entries it does not set (all of them, if the file does not exist) are taken from the built-in defaults, as are entries of the wrong type (with a warning). 'version' always holds the running OpenMS version.

◆ getTempDirectory()

static std::string getTempDirectory ( )
static

The current OpenMS temporary data path (for temporary files). Looks up the following locations, taking the first one which is set:

  • the OPENMS_TMPDIR environment variable
  • a non-empty 'temp_dir' entry in the OpenMS.ini read by getSystemParameters()
  • the system temp directory (usually defined by environment 'TMP' or 'TEMP') The path is returned as configured; it is not checked for existence.

Referenced by TOPPViewBase::finishTOPPToolExecution(), TOPPViewBase::showTOPPDialog_(), TOPPASBase::TOPPASBase(), and TOPPASBase::~TOPPASBase().

◆ getUserDirectory()

static std::string getUserDirectory ( )
static

The current OpenMS user data path (for result files), with a trailing '/'. Resolved in the following order, taking the first one which is set:

  1. the OPENMS_HOME_PATH environment variable
  2. a non-empty "home_dir" entry in the OpenMS.ini read by getSystemParameters()
  3. the user's home directory (HOME, or USERPROFILE on Windows)