Namespaces | |
apple | |
battery_info | |
clipboard | |
notifications | |
Classes | |
struct | path_info |
struct | bookmark_info |
Enumerations | |
enum | GAME_PATH_TYPES { GAME_BIN_DIR = 0 , GAME_CORE_DATA_DIR = 1 , GAME_USER_DATA_DIR = 3 , GAME_EDITOR_MAP_DIR = 4 } |
enum | SYSTEM_PATH_TYPES { SYSTEM_ALL_DRIVES = 0 , SYSTEM_USER_PROFILE = 1 , SYSTEM_ROOTFS = 2 } |
Functions | |
bool | open_object ([[maybe_unused]] const std::string &path_or_url) |
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 (const std::set< GAME_PATH_TYPES > &paths) |
Returns a list of game-related paths. More... | |
std::vector< path_info > | system_paths (const std::set< SYSTEM_PATH_TYPES > &paths) |
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 251 of file paths.cpp.
References config::add_child(), config::child_count(), label, and game_config::path.
Referenced by gui2::dialogs::file_dialog::on_bookmark_add_cmd().
std::vector< path_info > desktop::game_paths | ( | const std::set< GAME_PATH_TYPES > & | paths | ) |
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 200 of file paths.cpp.
References GAME_BIN_DIR, GAME_CORE_DATA_DIR, GAME_EDITOR_MAP_DIR, GAME_USER_DATA_DIR, filesystem::get_exe_dir(), filesystem::get_legacy_editor_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 | ( | [[maybe_unused] ] const std::string & | path_or_url | ) |
Definition at line 46 of file open.cpp.
References ERR_DU, LOG_DU, and t.
Referenced by gui2::dialogs::game_load::browse_button_callback(), gui2::dialogs::game_cache_options::browse_cache_callback(), gui2::dialogs::game_version::browse_directory_callback(), editor::editor_controller::do_execute_command(), gui2::dialogs::mp_lobby::open_profile_url(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::game_version::pre_show(), gui2::dialogs::mp_method_selection::pre_show(), gui2::dialogs::screenshot_notification::pre_show(), gui2::dialogs::game_version::report_issue(), gui2::dialogs::game_version::show_manual(), gui2::label::signal_handler_left_button_click(), and gui2::multiline_text::signal_handler_left_button_down().
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.
|
constexpr |
Returns whether open_object() is supported/implemented for the current platform.
Definition at line 54 of file open.hpp.
Referenced by editor::editor_controller::do_execute_command(), gui2::dialogs::file_dialog::pre_show(), gui2::dialogs::game_version::pre_show(), gui2::dialogs::game_version::report_issue(), gui2::dialogs::game_version::show_manual(), gui2::label::signal_handler_left_button_click(), and gui2::multiline_text::signal_handler_left_button_down().
std::ostream & desktop::operator<< | ( | std::ostream & | os, |
const path_info & | pinf | ||
) |
Definition at line 195 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 216 of file version.cpp.
References _(), ERR_DU, filesystem::file_exists(), desktop::apple::os_version(), and p.
Referenced by game_config::full_build_report(), and gui2::dialogs::game_version::pre_show().
void desktop::remove_user_bookmark | ( | unsigned | index | ) |
Definition at line 264 of file paths.cpp.
References config::child_count(), utf8::index(), and config::remove_child().
Referenced by gui2::dialogs::file_dialog::on_bookmark_del_cmd().
std::vector< path_info > desktop::system_paths | ( | const std::set< SYSTEM_PATH_TYPES > & | paths | ) |
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 228 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 276 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 166 of file paths.cpp.
Referenced by system_paths().