From 2429308bac5751fb136515027f6762ba76a7eb3d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 11 Feb 2016 16:43:35 +0100 Subject: [PATCH] Open URis with spaces. --- libs/pbd/openuri.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/pbd/openuri.cc b/libs/pbd/openuri.cc index 5f4f1ab546..5e7e8f5a02 100644 --- a/libs/pbd/openuri.cc +++ b/libs/pbd/openuri.cc @@ -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()); -- 2.30.2