The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
open.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2017 by Ignacio Riquelme Morelle <shadowm2006@gmail.com>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * Desktop environment interaction functions.
18  */
19 
20 #pragma once
21 
22 #include <string>
23 
24 namespace desktop {
25 
26 /**
27  * Opens the specified object with the default application configured for its type.
28  *
29  * The default application for handling the object represented by
30  * @a path_or_url is defined by the operating system and desktop environment
31  * under which Wesnoth is running, and it is not under our control. Therefore,
32  * <b>EXTREME CAUTION</b> is advised when using this function with URLs or
33  * paths that are entirely or partially constructed from user-provided input
34  * (e.g., WML from user-made add-ons, chat log messages).
35  *
36  * If the content pointed to by @a path_or_url cannot be trusted, you should
37  * either refrain from using this function, or warn the user before calling
38  * this function.
39  *
40  * @note Currently, only X11, Apple OS X, and Microsoft Windows are supported.
41  * Using this function on unsupported platforms will result in an error
42  * message logged in stderr.
43  *
44  * @return @a true on success, @a false otherwise. Failure to perform the
45  * platform call means either that we do not currently support the
46  * running platform, the child process exited with a non-zero status,
47  * or something else went wrong. Thus, a value of @a true does not
48  * truly guarantee success -- take it with a grain of salt.
49  */
50 bool open_object(const std::string& path_or_url);
51 
52 /** Returns whether open_object() is supported/implemented for the current platform. */
54 
55 }
std::vector< char_t > string
bool open_object(const std::string &path_or_url)
Opens the specified object with the default application configured for its type.
Definition: open.cpp:53
bool open_object_is_supported()
Returns whether open_object() is supported/implemented for the current platform.
Definition: open.cpp:44