Properly encode file URIs in the sfdb.
authorTaybin Rutkin <taybin@taybin.com>
Fri, 1 Dec 2006 17:37:08 +0000 (17:37 +0000)
committerTaybin Rutkin <taybin@taybin.com>
Fri, 1 Dec 2006 17:37:08 +0000 (17:37 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1184 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_library.cc

index 7a8414946ce79db2712821299a9dd27426b0ab5a..92069d929ff7c25ea3af2916256d8bc4234b76ec 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <sstream>
 
+#include <libxml/uri.h>
+
 #include <lrdf.h>
 
 #include <pbd/compose.h>
@@ -59,8 +61,19 @@ AudioLibrary::save_changes ()
 string
 AudioLibrary::path2uri (string path)
 {
+       xmlURI temp;
+       memset(&temp, 0, sizeof(temp));
+       
+       xmlChar *cal = xmlCanonicPath((xmlChar*) path.c_str());
+       temp.path = (char *) cal;
+       xmlChar *ret = xmlSaveUri(&temp);
+       xmlFree(cal);
+       
        stringstream uri;
-       uri << "file:" << path;
+       uri << "file:" << (const char*) ret;
+       
+       xmlFree (ret);
+       
        return uri.str();
 }