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
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#endif
#include <boost/scoped_ptr.hpp>
#include <boost/algorithm/string.hpp>
#include <string>
#include <glibmm/spawn.h>
@ -103,9 +104,12 @@ PBD::open_folder (const std::string& d)
bool rv = false;
if (curl) {
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);
curl_free (e);
curl_easy_cleanup(curl);
}
return rv;
#else