diff options
author | Robin Gareus <robin@gareus.org> | 2016-02-17 16:29:25 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-02-17 16:29:25 +0100 |
commit | 5e50a7d6cfe76f04d018f5695fd47cc837c1fb24 (patch) | |
tree | b89c14b79712d4566ba8dd904af7a4b760080e57 /libs/pbd/openuri.cc | |
parent | 90efd9f0100d191668b8e320664768499ade88df (diff) |
allot to open OSX Finder with arbitrary paths
Diffstat (limited to 'libs/pbd/openuri.cc')
-rw-r--r-- | libs/pbd/openuri.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/pbd/openuri.cc b/libs/pbd/openuri.cc index 5e7e8f5a02..f96150f5db 100644 --- a/libs/pbd/openuri.cc +++ b/libs/pbd/openuri.cc @@ -29,6 +29,7 @@ #include "pbd/openuri.h" #ifdef __APPLE__ +#include <curl/curl.h> extern bool cocoa_open_url (const char*); #endif @@ -77,3 +78,19 @@ PBD::open_uri (const std::string& uri) { return open_uri (uri.c_str()); } + +bool +PBD::open_folder (const std::string& d) +{ +#ifdef __APPLE__ + CURL *curl = curl_easy_init (); + if (curl) { + char * e = curl_easy_escape (curl, d.c_str(), d.size()); + std::string url = "file:///" + std::string(e); + PBD::open_uri (url); + curl_free (e); + } +#else + PBD::open_uri (d); +#endif +} |