Platform folders  4.2.0
Functions
sago Namespace Reference

Functions

std::string getDataHome ()
 
std::string getConfigHome ()
 
std::string getCacheDir ()
 
std::string getStateDir ()
 
void appendAdditionalDataDirectories (std::vector< std::string > &homes)
 
void appendAdditionalConfigDirectories (std::vector< std::string > &homes)
 
std::string getDesktopFolder ()
 
std::string getDocumentsFolder ()
 
std::string getDownloadFolder ()
 
std::string getDownloadFolder1 ()
 
std::string getPicturesFolder ()
 
std::string getPublicFolder ()
 
std::string getMusicFolder ()
 
std::string getVideoFolder ()
 
std::string getSaveGamesFolder1 ()
 
std::string getSaveGamesFolder2 ()
 

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/";
}
void appendAdditionalConfigDirectories(std::vector< std::string > &homes)
std::string getConfigHome()

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/";
}
void appendAdditionalDataDirectories(std::vector< std::string > &homes)
std::string getDataHome()

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 storing cache files. You must add the program name yourself like this:

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

On Windows this defaults to APPDATALOCAL% On Linux this defaults to ~/.cache but can be configured by the user Note that it is recommended to append "cache" after the program name to prevent conflicting with "StateDir" under Windows

Returns
The base folder for storing data that do not need to be backed up and might be deleted.

◆ getConfigHome()

std::string sago::getConfigHome ( )

Retrives the base folder for storing 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 by the user

Returns
The base folder for storing config data.

◆ getDataHome()

std::string sago::getDataHome ( )

Retrives the base folder for storing 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 by the user

Returns
The base folder for storing program data.

◆ getDesktopFolder()

std::string sago::getDesktopFolder ( )

The folder that represents the desktop. Normally you should try not to use this folder.

Returns
Absolute path to the user's desktop

◆ getDocumentsFolder()

std::string sago::getDocumentsFolder ( )

The folder to store user documents to

Returns
Absolute path to the "Documents" folder

◆ getDownloadFolder()

std::string sago::getDownloadFolder ( )

The folder where files are downloaded.

Returns
Absolute path to the folder where files are downloaded to.

◆ getDownloadFolder1()

std::string sago::getDownloadFolder1 ( )

The folder where files are downloaded.

Note
This is provided for backward compatibility. Use getDownloadFolder instead.
Returns
Absolute path to the folder where files are downloaded to.

◆ getMusicFolder()

std::string sago::getMusicFolder ( )

The folder where music is stored

Returns
Absolute path to the music folder

◆ getPicturesFolder()

std::string sago::getPicturesFolder ( )

The folder for storing the user's pictures.

Returns
Absolute path to the "Picture" folder

◆ getPublicFolder()

std::string sago::getPublicFolder ( )

This returns the folder that can be used for sharing files with other users on the same system.

Returns
Absolute path to the "Public" folder

◆ getSaveGamesFolder1()

std::string sago::getSaveGamesFolder1 ( )

A base folder for storing saved games. You must add the program name to it like this:

string saved_games_folder = sago::getSaveGamesFolder1()+"/My Program Name/";
std::string getSaveGamesFolder1()
Note
Windows: This is an XP compatible version and returns the path to "My Games" in Documents. Vista and later has an official folder.
Linux: XDF does not define a folder for saved games. This will just return the same as GetDataHome()
Returns
The folder base folder for storing save games.

◆ getSaveGamesFolder2()

std::string sago::getSaveGamesFolder2 ( )

A base folder for storing saved games. You must add the program name to it like this:

string saved_games_folder = sago::getSaveGamesFolder2()+"/My Program Name/";
std::string getSaveGamesFolder2()
Note
PlatformFolders provide different folders to for saved games as not all operating systems has support for Saved Games yet. It is recommended to pick the highest number (currently getSaveGamesFolder2) at the time your product enters production and stick with it
Windows: This returns the "Saved Games" folder. This folder exist in Vista and later
Linux: XDF does not define a folder for saved games. This will just return the same as GetDataHome()
Returns
The folder base folder for storing save games.

◆ getStateDir()

std::string sago::getStateDir ( )

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

string data_home = getStateDir()+"/My Program Name/";
std::string getStateDir()

On Windows this defaults to APPDATALOCAL% On Linux this defaults to ~/.local/state but can be configured by the user On OS X this is the same as getDataHome()

Returns
The base folder for storing data that do not need to be backed up but should not be reguarly deleted either.

◆ getVideoFolder()

std::string sago::getVideoFolder ( )

The folder where video is stored

Returns
Absolute path to the video folder