platformdirs 0.1.0
📂 Python's platformdirs module for C++
Loading...
Searching...
No Matches
platformdirs::unix::unix Class Reference

#include <unix.h>

Inheritance diagram for platformdirs::unix::unix:
platformdirs::api::platform_dirs_abc

Public Member Functions

 unix (const std::optional< std::string > &appname=std::nullopt, const std::variant< std::string, std::nullopt_t, bool > &appauthor=std::nullopt, const std::optional< std::string > &version=std::nullopt, bool roaming=false, bool multipath=false, bool opinion=true, bool ensure_exists=false)
 
std::string user_data_dir () const override
 
std::string site_data_dir () const override
 
std::string user_config_dir () const override
 
std::string site_config_dir () const override
 
std::string user_cache_dir () const override
 
std::string site_cache_dir () const override
 
std::string user_state_dir () const override
 
std::string user_log_dir () const override
 
std::string user_documents_dir () const override
 
std::string user_downloads_dir () const override
 
std::string user_pictures_dir () const override
 
std::string user_videos_dir () const override
 
std::string user_music_dir () const override
 
std::string user_desktop_dir () const override
 
std::string user_runtime_dir () const override
 
std::string site_runtime_dir () const override
 
std::filesystem::path site_data_path () const override
 
std::filesystem::path site_config_path () const override
 
std::filesystem::path site_cache_path () const override
 
- Public Member Functions inherited from platformdirs::api::platform_dirs_abc
 platform_dirs_abc (const std::optional< std::string > &appname=std::nullopt, const std::variant< std::string, std::nullopt_t, bool > &appauthor=std::nullopt, const std::optional< std::string > &version=std::nullopt, bool roaming=false, bool multipath=false, bool opinion=true, bool ensure_exists=false)
 
virtual std::filesystem::path user_data_path () const
 
virtual std::filesystem::path user_config_path () const
 
virtual std::filesystem::path user_cache_path () const
 
virtual std::filesystem::path user_state_path () const
 
virtual std::filesystem::path user_log_path () const
 
virtual std::filesystem::path user_documents_path () const
 
virtual std::filesystem::path user_downloads_path () const
 
virtual std::filesystem::path user_pictures_path () const
 
virtual std::filesystem::path user_videos_path () const
 
virtual std::filesystem::path user_music_path () const
 
virtual std::filesystem::path user_desktop_path () const
 
virtual std::filesystem::path user_runtime_path () const
 
virtual std::filesystem::path site_runtime_path () const
 

Additional Inherited Members

- Public Attributes inherited from platformdirs::api::platform_dirs_abc
std::optional< std::string > appname
 
std::variant< std::string, std::nullopt_t, bool > appauthor
 
std::optional< std::string > version
 
bool roaming
 
bool multipath
 
bool opinion
 
bool ensure_exists
 
- Protected Member Functions inherited from platformdirs::api::platform_dirs_abc
auto append_app_name_and_version (const std::vector< std::string > &base) const -> std::string
 
auto optionally_create_directory (const std::string &path) const -> void
 

Detailed Description

On Unix/Linux, we follow the XDG Basedir Spec https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html.

The spec allows overriding directories with environment variables. The examples shown are the default values, alongside the name of the environment variable that overrides them. Makes use of the appname, version, multipath, opinion, ensure_exists.

Constructor & Destructor Documentation

◆ unix()

platformdirs::unix::unix::unix ( const std::optional< std::string > & appname = std::nullopt,
const std::variant< std::string, std::nullopt_t, bool > & appauthor = std::nullopt,
const std::optional< std::string > & version = std::nullopt,
bool roaming = false,
bool multipath = false,
bool opinion = true,
bool ensure_exists = false )

Member Function Documentation

◆ site_cache_dir()

std::string platformdirs::unix::unix::site_cache_dir ( ) const
overridevirtual
Returns
cache directory shared by users, e.g. /var/cache/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ site_cache_path()

auto platformdirs::unix::unix::site_cache_path ( ) const
overridevirtual

◆ site_config_dir()

std::string platformdirs::unix::unix::site_config_dir ( ) const
overridevirtual
Returns
config directories shared by users (if multipath is enabled and XDG_CONFIG_DIRS is set and a multi path the response is also a multi path separated by the OS path separator), e.g. /etc/xdg/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ site_config_path()

auto platformdirs::unix::unix::site_config_path ( ) const
overridevirtual

◆ site_data_dir()

std::string platformdirs::unix::unix::site_data_dir ( ) const
overridevirtual
Returns
data directories shared by users (if multipath is enabled and XDG_DATA_DIRS is set and a multi path the response is also a multi path separated by the OS path separator), e.g. /usr/local/share/$appname/$version or /usr/share/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ site_data_path()

auto platformdirs::unix::unix::site_data_path ( ) const
overridevirtual

◆ site_runtime_dir()

auto platformdirs::unix::unix::site_runtime_dir ( ) const
overridevirtual

◆ user_cache_dir()

auto platformdirs::unix::unix::user_cache_dir ( ) const
overridevirtual
Returns
cache directory tied to the user, e.g. ~/.cache/$appname/$version or ~/$XDG_CACHE_HOME/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ user_config_dir()

auto platformdirs::unix::unix::user_config_dir ( ) const
overridevirtual
Returns
config directory tied to the user, e.g. ~/.config/$appname/$version or $XDG_CONFIG_HOME/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ user_data_dir()

std::string platformdirs::unix::unix::user_data_dir ( ) const
overridevirtual
Returns
data directory tied to the user, e.g. ~/.local/share/$appname/$version or $XDG_DATA_HOME/$appname/$version

Implements platformdirs::api::platform_dirs_abc.

◆ user_desktop_dir()

auto platformdirs::unix::unix::user_desktop_dir ( ) const
overridevirtual

◆ user_documents_dir()

auto platformdirs::unix::unix::user_documents_dir ( ) const
overridevirtual

◆ user_downloads_dir()

auto platformdirs::unix::unix::user_downloads_dir ( ) const
overridevirtual

◆ user_log_dir()

auto platformdirs::unix::unix::user_log_dir ( ) const
overridevirtual

◆ user_music_dir()

auto platformdirs::unix::unix::user_music_dir ( ) const
overridevirtual

◆ user_pictures_dir()

auto platformdirs::unix::unix::user_pictures_dir ( ) const
overridevirtual

◆ user_runtime_dir()

auto platformdirs::unix::unix::user_runtime_dir ( ) const
overridevirtual

◆ user_state_dir()

auto platformdirs::unix::unix::user_state_dir ( ) const
overridevirtual

◆ user_videos_dir()

auto platformdirs::unix::unix::user_videos_dir ( ) const
overridevirtual

The documentation for this class was generated from the following files: