allot to open OSX Finder with arbitrary paths
This commit is contained in:
parent
90efd9f010
commit
5e50a7d6cf
@ -163,7 +163,7 @@ SessionDirectory::sources_root () const
|
||||
root_cache[m_root_path] = Glib::build_filename (sources_root_path, entries.front());
|
||||
}
|
||||
else if (entries.size() > 1) {
|
||||
PBD::open_uri (sources_root_path);
|
||||
PBD::open_folder (sources_root_path);
|
||||
PBD::fatal << string_compose (_("The session's interchange dir is tainted.\nThere is more than one folder in '%1'.\nPlease remove extra subdirs to reduce possible filename ambiguties."), sources_root_path) << endmsg;
|
||||
assert (0); // not reached
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
namespace PBD {
|
||||
LIBPBD_API bool open_uri (const char*);
|
||||
LIBPBD_API bool open_uri (const std::string&);
|
||||
LIBPBD_API bool open_folder (const std::string&);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user