13
0

Fix macOS URI open

curl_easy_escape() escapes slashes, which fails with openURL on modern macOS.
Also add missing call to curl_easy_cleanup().
This commit is contained in:
Robin Gareus 2022-12-08 01:50:28 +01:00
parent ea50799ce2
commit 201617f03b

View File

@ -23,6 +23,7 @@
#endif #endif
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/algorithm/string.hpp>
#include <string> #include <string>
#include <glibmm/spawn.h> #include <glibmm/spawn.h>
@ -103,9 +104,12 @@ PBD::open_folder (const std::string& d)
bool rv = false; bool rv = false;
if (curl) { if (curl) {
char * e = curl_easy_escape (curl, d.c_str(), d.size()); char * e = curl_easy_escape (curl, d.c_str(), d.size());
std::string url = "file:///" + std::string(e); std::string p (e);
boost::replace_all (p, "%2F", "/");
std::string url = "file://" + p;
rv = PBD::open_uri (url); rv = PBD::open_uri (url);
curl_free (e); curl_free (e);
curl_easy_cleanup(curl);
} }
return rv; return rv;
#else #else