Open URis with spaces.
authorRobin Gareus <robin@gareus.org>
Thu, 11 Feb 2016 15:43:35 +0000 (16:43 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 11 Feb 2016 15:43:35 +0000 (16:43 +0100)
libs/pbd/openuri.cc

index 5f4f1ab5461cd83306a51a65ee43b7229aade13f..5e7e8f5a022bf653e3f08ebf9ecb069c40493c6b 100644 (file)
@@ -57,8 +57,14 @@ PBD::open_uri (const char* uri)
                global_epa->restore ();
        }
 
+       std::string s(uri);
+       while (s.find("\\") != std::string::npos)
+               s.replace(s.find("\\"), 1, "\\\\");
+       while (s.find("\"") != std::string::npos)
+               s.replace(s.find("\\"), 1, "\\\"");
+
        std::string command = "xdg-open ";
-       command += uri;
+       command += '"' + s + '"';
        command += " &";
        (void) system (command.c_str());