cartobase 6.0.6
carto::Paths Namespace Reference

Paths to configuration / shared data directories. More...

Functions

const std::string & home ()
 User home directory.
 
const std::string & tempDir ()
 Temporary directory used for general usage.
 
const std::string & memmap ()
 Temporary directory used for memory mapping with copy - this directory has better be large.
 
const std::string & installRoot ()
 Root path of the BrainVisa install directory.
 
const std::string & globalShared ()
 The base shared directory for all cartograph / SHFJ data.
 
const std::string & shfjShared ()
 Shared directory for SHFJ-specific data.
 
const std::list< std::string > & resourceSearchPath ()
 Shared resource files search path.
 
void addResourceSearchPath (const std::string &path, bool atbeginning=false)
 
std::string findResourceFile (const std::string &filename, const std::string &project="", const std::string &version="")
 Find a file in the shared resources directories, or in a personal directory.
 
std::list< std::string > findResourceFiles (const std::string &filename, const std::string &project="", const std::string &version="")
 Same as findResourceFile() except that it looks for every occurrence of the searched file (or directory).
 
const std::string & argv0 ()
 argv[0], ie executable name and path; only available when a CartoApplication has been built
 
void setArgv0 (const std::string &argv0)
 

Detailed Description

Paths to configuration / shared data directories.

The functions in Paths provide a portable access to the paths of useful directories that may depend on the site or user configuration, or on environment variables (such as BRAINVISA_SHARE or HOME ).

Path is implemented as a namespace rather than a class with static methods so that it can easily be extended in upper-level libraries.

Function Documentation

◆ addResourceSearchPath()

void carto::Paths::addResourceSearchPath ( const std::string & path,
bool atbeginning = false )

◆ argv0()

const std::string & carto::Paths::argv0 ( )

argv[0], ie executable name and path; only available when a CartoApplication has been built

Referenced by setArgv0().

◆ findResourceFile()

std::string carto::Paths::findResourceFile ( const std::string & filename,
const std::string & project = "",
const std::string & version = "" )

Find a file in the shared resources directories, or in a personal directory.

Files are looked in the search paths given by resourceSearchPath(). For each search path, the filename is looked in a subdirectory containing the project name and version (if not specified, cartobase version is used), and then in a subdirectory containing the project name without version. For personal directories, a dot may be prepended to the project name for use as a hidden directory (classical on Unix), like "/home/user/.anatomist/..." The function stops at the first match and return the first path.

◆ findResourceFiles()

std::list< std::string > carto::Paths::findResourceFiles ( const std::string & filename,
const std::string & project = "",
const std::string & version = "" )

Same as findResourceFile() except that it looks for every occurrence of the searched file (or directory).

◆ globalShared()

const std::string & carto::Paths::globalShared ( )

The base shared directory for all cartograph / SHFJ data.

◆ home()

const std::string & carto::Paths::home ( )

User home directory.

◆ installRoot()

const std::string & carto::Paths::installRoot ( )

Root path of the BrainVisa install directory.

◆ memmap()

const std::string & carto::Paths::memmap ( )

Temporary directory used for memory mapping with copy - this directory has better be large.

◆ resourceSearchPath()

const std::list< std::string > & carto::Paths::resourceSearchPath ( )

Shared resource files search path.

It typically includes:

◆ setArgv0()

void carto::Paths::setArgv0 ( const std::string & argv0)

References argv0().

◆ shfjShared()

const std::string & carto::Paths::shfjShared ( )

Shared directory for SHFJ-specific data.

Depending on the installation and configuration, this may be the same as the globalShared() directory.

◆ tempDir()

const std::string & carto::Paths::tempDir ( )

Temporary directory used for general usage.