The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Functions
desktop Namespace Reference

Namespaces

 clipboard
 
 notifications
 

Functions

bool open_object_is_supported ()
 Returns whether open_object() is supported/implemented for the current platform. More...
 
bool open_object (const std::string &path_or_url)
 Opens the specified object with the default application configured for its type. More...
 
std::string os_version ()
 Returns a string with the running OS name and version information. More...
 

Function Documentation

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.

Note
Currently, only X11, Apple OS X, and Microsoft Windows are supported. Using this function on unsupported platforms will result in an error message logged in stderr.
Returns
true on success, false otherwise. Failure to perform the platform call means either that we do not currently support the running platform, the child process exited with a non-zero status, or something else went wrong. Thus, a value of true does not truly guarantee success – take it with a grain of salt.

Definition at line 53 of file open.cpp.

References ERR_DU, LOG_DU, unicode_cast(), and UNUSED.

Referenced by gui2::tgame_cache_options::browse_cache_callback(), gui2::tgame_version::browse_directory_callback(), gui2::taddon_description::browse_url_callback(), gui2::taddon_list::browse_url_callback(), gui2::tscreenshot_notification::pre_show(), and gui2::tlabel::signal_handler_left_button_click().

bool desktop::open_object_is_supported ( )

Returns whether open_object() is supported/implemented for the current platform.

Definition at line 44 of file open.cpp.

Referenced by gui2::taddon_list::pre_show(), gui2::taddon_description::pre_show(), gui2::tgame_version::pre_show(), and gui2::tlabel::signal_handler_left_button_click().

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 118 of file version.cpp.

References _(), ERR_DU, filesystem::file_exists(), unicode_cast(), and game_config::version.

Referenced by gui2::tgame_version::generate_plain_text_report(), and gui2::tgame_version::pre_show().