missing includes
[ardour.git] / libs / pbd / openuri.cc
1 #ifdef WAF_BUILD
2 #include "libpbd-config.h"
3 #endif
4
5 #include <boost/scoped_ptr.hpp>
6 #include <string>
7 #include <glibmm/spawn.h>
8
9 #include "pbd/epa.h"
10 #include "pbd/openuri.h"
11
12 bool
13 PBD::open_uri (const char* uri)
14 {
15 #ifdef __APPLE__
16         extern bool cocoa_open_url (const char*);
17         return cocoa_open_url (uri);
18 #else
19         EnvironmentalProtectionAgency* global_epa = EnvironmentalProtectionAgency::get_global_epa ();
20         boost::scoped_ptr<EnvironmentalProtectionAgency> current_epa;
21
22         /* revert all environment settings back to whatever they were when ardour started
23          */
24
25         if (global_epa) {
26                 current_epa.reset (new EnvironmentalProtectionAgency(true)); /* will restore settings when we leave scope */
27                 global_epa->restore ();
28         }
29
30         std::string command = "xdg-open ";
31         command += uri;
32         command += " &";
33         system (command.c_str());
34
35         return true;
36 #endif
37 }
38