Namespaces | |
apple | |
battery_info | |
clipboard | |
notifications | |
Classes | |
struct | bookmark_info |
struct | path_info |
Enumerations | |
enum | GAME_PATH_TYPES { GAME_BIN_DIR = 0x1, GAME_CORE_DATA_DIR = 0x2, GAME_USER_PREFS_DIR = 0x4, GAME_USER_DATA_DIR = 0x8 } |
enum | SYSTEM_PATH_TYPES { SYSTEM_ALL_DRIVES = 0x1, SYSTEM_USER_PROFILE = 0x2, SYSTEM_ROOTFS = 0x4 } |
Functions | |
bool | open_object (const std::string &path_or_url) |
Opens the specified object with the default application configured for its type. More... | |
constexpr bool | open_object_is_supported () |
Returns whether open_object() is supported/implemented for the current platform. More... | |
std::string | user_profile_dir () |
Returns the path to the user profile dir (e.g. More... | |
std::ostream & | operator<< (std::ostream &os, const path_info &pinf) |
std::vector< path_info > | game_paths (unsigned path_types=GAME_CORE_DATA_DIR|GAME_USER_DATA_DIR) |
Returns a list of game-related paths. More... | |
std::vector< path_info > | system_paths (unsigned path_types=SYSTEM_ALL_DRIVES|SYSTEM_USER_PROFILE|SYSTEM_ROOTFS) |
Returns a list of system-defined paths. More... | |
unsigned | add_user_bookmark (const std::string &label, const std::string &path) |
void | remove_user_bookmark (unsigned index) |
std::vector< bookmark_info > | user_bookmarks () |
std::string | os_version () |
Returns a string with the running OS name and version information. More... | |
unsigned desktop::add_user_bookmark | ( | const std::string & | label, |
const std::string & | path | ||
) |
Definition at line 241 of file paths.cpp.
References config::add_child(), config::child_count(), desktop::path_info::label, and desktop::path_info::path.
Referenced by gui2::dialogs::file_dialog::on_bookmark_add_cmd().
std::vector< path_info > desktop::game_paths | ( | unsigned | path_types = GAME_CORE_DATA_DIR|GAME_USER_DATA_DIR | ) |
Returns a list of game-related paths.
These paths are guaranteed to be their canonical forms (with links and dot entries resolved) and using the platform's preferred path delimiter.
Definition at line 190 of file paths.cpp.
References GAME_BIN_DIR, GAME_CORE_DATA_DIR, GAME_USER_DATA_DIR, GAME_USER_PREFS_DIR, filesystem::get_exe_dir(), filesystem::get_user_config_dir(), filesystem::get_user_data_dir(), GETTEXT_DOMAIN, N_, and game_config::path.
Referenced by gui2::dialogs::file_dialog::pre_show().
bool desktop::open_object | ( | const std::string & | path_or_url | ) |
Opens the specified object with the default application configured for its type.
The default application for handling the object represented by path_or_url is defined by the operating system and desktop environment under which Wesnoth is running, and it is not under our control. Therefore, EXTREME CAUTION is advised when using this function with URLs or paths that are entirely or partially constructed from user-provided input (e.g., WML from user-made add-ons, chat log messages).
If the content pointed to by path_or_url cannot be trusted, you should either refrain from using this function, or warn the user before calling this function.
Definition at line 46 of file open.cpp.
References ERR_DU, LOG_DU, t, unicode_cast(), and UNUSED.
Referenced by gui2::dialogs::game_load::browse_button_callback(), gui2::dialogs::game_cache_options::browse_cache_callback(), gui2::dialogs::game_version::browse_directory_callback(), gui2::dialogs::mp_method_selection::pre_show(), gui2::dialogs::screenshot_notification::pre_show(), gui2::dialogs::mp_lobby::pre_show(), and gui2::label::signal_handler_left_button_click().
constexpr bool desktop::open_object_is_supported | ( | ) |
Returns whether open_object() is supported/implemented for the current platform.
Definition at line 53 of file open.hpp.
Referenced by gui2::dialogs::game_version::pre_show(), and gui2::label::signal_handler_left_button_click().
std::ostream & desktop::operator<< | ( | std::ostream & | os, |
const path_info & | pinf | ||
) |
Definition at line 185 of file paths.cpp.
References desktop::path_info::label, desktop::path_info::name, and desktop::path_info::path.
std::string desktop::os_version | ( | ) |
Returns a string with the running OS name and version information.
On Windows, this is a string we generate ourselves by processing GetVersionEx's output. On OS X and Linux, this is the output of a command provided by the OS if available; failing that (and on other Unixes as well), we use the uname system call, which is hardly ever useful.
Definition at line 163 of file version.cpp.
References _(), ERR_DU, filesystem::file_exists(), desktop::apple::os_version(), p, and unicode_cast().
Referenced by game_config::full_build_report(), os_version(), and gui2::dialogs::game_version::pre_show().
void desktop::remove_user_bookmark | ( | unsigned | index | ) |
Definition at line 254 of file paths.cpp.
References config::child_count(), and config::remove_child().
Referenced by gui2::dialogs::file_dialog::on_bookmark_del_cmd().
std::vector< path_info > desktop::system_paths | ( | unsigned | path_types = SYSTEM_ALL_DRIVES|SYSTEM_USER_PROFILE|SYSTEM_ROOTFS | ) |
Returns a list of system-defined paths.
This includes removable media on platforms where we can reasonably accurately enumerate those (FIXME: only Windows right now), the path to the user's profile directory (/home/username, X:\Users\Username, etc.), and the system drive root.
These paths are guaranteed to be their canonical forms (with links and dot entries resolved) and using the platform's preferred path delimiter.
Definition at line 218 of file paths.cpp.
References GETTEXT_DOMAIN, N_, SYSTEM_ALL_DRIVES, SYSTEM_ROOTFS, SYSTEM_USER_PROFILE, and user_profile_dir().
Referenced by gui2::dialogs::file_dialog::pre_show().
std::vector< bookmark_info > desktop::user_bookmarks | ( | ) |
Definition at line 266 of file paths.cpp.
References config::child_range(), and config::has_child().
Referenced by gui2::dialogs::file_dialog::pre_show().
std::string desktop::user_profile_dir | ( | ) |
Returns the path to the user profile dir (e.g.
/home/username).
An empty string is returned if the path cannot be determined somehow.
Definition at line 156 of file paths.cpp.
References unicode_cast().
Referenced by system_paths().