cartobase  5.0.5
carto::Paths Namespace Reference

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

Functions

const std::string & home ()
 User home directory. More...
 
const std::string & tempDir ()
 Temporary directory used for general usage. More...
 
const std::string & memmap ()
 Temporary directory used for memory mapping with copy - this directory has better be large. More...
 
const std::string & globalShared ()
 The base shared directory for all cartograph / SHFJ data. More...
 
const std::string & shfjShared ()
 Shared directory for SHFJ-specific data. More...
 
const std::list< std::string > & resourceSearchPath ()
 Shared resource files search path. More...
 
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. More...
 
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). More...
 
const std::string & argv0 ()
 argv[0], ie executable name and path; only available when a CartoApplication has been built More...
 
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

◆ 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.

◆ 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)

◆ 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.