Platform folders  3.0
Classes | Functions
sago Namespace Reference

Classes

class  PlatformFolders
 

Functions

std::string getDataHome ()
 
std::string getConfigHome ()
 
std::string getCacheDir ()
 
void appendAdditionalDataDirectories (std::vector< std::string > &homes)
 
void appendAdditionalConfigDirectories (std::vector< std::string > &homes)
 

Detailed Description

The namespace I use for common function. Nothing special about it.

Function Documentation

◆ appendAdditionalConfigDirectories()

void sago::appendAdditionalConfigDirectories ( std::vector< std::string > &  homes)

This will append extra folders that your program should be looking for config files in. This does not normally include the path returned by GetConfigHome(). If you want all the folders you should do something like:

std::vector<std::string> folders;
folders.push_back(sago::getConfigHome());
for (std::string s& : folders) {
s+="/My Program Name/";
}

You must apply "/My Program Name/" to all the strings. The string at the lowest index has the highest priority.

Parameters
homesA vector that extra folders will be appended to.

◆ appendAdditionalDataDirectories()

void sago::appendAdditionalDataDirectories ( std::vector< std::string > &  homes)

This will append extra folders that your program should be looking for data files in. This does not normally include the path returned by GetDataHome(). If you want all the folders you should do something like:

vector<string> folders;
folders.push_back(getDataHome());
for (string s& : folders) {
s+="/My Program Name/";
}

You must apply "/My Program Name/" to all the strings. The string at the lowest index has the highest priority.

Parameters
homesA vector that extra folders will be appended to.

◆ getCacheDir()

std::string sago::getCacheDir ( )

Retrives the base folder for storring cache files. You must add the program name yourself like this:

string data_home = getCacheDir()+"/My Program Name/";

On Windows this defaults to APPDATALOCAL% On Linux this defaults to ~/.cache but can be configured

Returns
The base folder for storring data that do not need to be backed up.

◆ getConfigHome()

std::string sago::getConfigHome ( )

Retrives the base folder for storring config files. You must add the program name yourself like this:

string data_home = getConfigHome()+"/My Program Name/";

On Windows this defaults to APPDATA% (Roaming profile) On Linux this defaults to ~/.config but can be configured

Returns
The base folder for storring config data.

◆ getDataHome()

std::string sago::getDataHome ( )

Retrives the base folder for storring data files. You must add the program name yourself like this:

string data_home = getDataHome()+"/My Program Name/";

On Windows this defaults to APPDATA% (Roaming profile) On Linux this defaults to ~/.local/share but can be configured

Returns
The base folder for storring program data.