Use sys::path and ARDOUR::user_config_directory in AudioLibrary for portablility
authorTim Mayberry <mojofunk@gmail.com>
Wed, 27 Jun 2007 12:12:10 +0000 (12:12 +0000)
committerTim Mayberry <mojofunk@gmail.com>
Wed, 27 Jun 2007 12:12:10 +0000 (12:12 +0000)
Use Glib::filename_to_uri to create the src uri(which didn't look valid as it was)

git-svn-id: svn://localhost/ardour2/trunk@2046 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_library.cc

index 2ed4739a961fe357e58caf49821ebf657d8cccfd..a15e08d5f9f3f228d0271c0e9d5f6c4b36da6776 100644 (file)
 
 #include <lrdf.h>
 
+#include <glibmm/convert.h>
+
 #include <pbd/compose.h>
 
 #include <ardour/audio_library.h>
 #include <ardour/utils.h>
+#include <ardour/filesystem_paths.h>
 
 #include "i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
 
+namespace {
+       const char* const sfdb_file_name = "sfdb";
+} // anonymous namespace
+
 static char* TAG = "http://ardour.org/ontology/Tag";
 
 AudioLibrary::AudioLibrary ()
 {
-       src = "file:" + get_user_ardour_path() + "sfdb";
+       sys::path sfdb_file_path(user_config_directory ());
 
+       sfdb_file_path /= sfdb_file_name;
+
+       src = Glib::filename_to_uri (sfdb_file_path.to_string ());
+       
        // workaround for possible bug in raptor that crashes when saving to a
        // non-existant file.
-       touch_file(get_user_ardour_path() + "sfdb");
+       touch_file(sfdb_file_path.to_string());
 
        lrdf_read_file(src.c_str());
 }