LTC Slave, add support for variable framerates
[ardour.git] / libs / surfaces / mackie / device_profile.cc
index 110038ca2bcb1e8bd259fd11724d3079a728cb58..ea57458e1c9715ccf74b286e7e497a1f05d26aff 100644 (file)
@@ -55,34 +55,26 @@ static const char * const devprofile_env_variable_name = "ARDOUR_MCP_PATH";
 static const char* const devprofile_dir_name = "mcp";
 static const char* const devprofile_suffix = ".profile";
 
-static sys::path
-system_devprofile_search_path ()
+static SearchPath
+devprofile_search_path ()
 {
        bool devprofile_path_defined = false;
-        sys::path spath_env (Glib::getenv (devprofile_env_variable_name, devprofile_path_defined));
+        std::string spath_env (Glib::getenv (devprofile_env_variable_name, devprofile_path_defined));
 
        if (devprofile_path_defined) {
                return spath_env;
        }
 
-       SearchPath spath (system_data_search_path());
+       SearchPath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(devprofile_dir_name);
 
-       // just return the first directory in the search path that exists
-       SearchPath::const_iterator i = std::find_if(spath.begin(), spath.end(), sys::exists);
-
-       if (i == spath.end()) return sys::path();
-
-       return *i;
+       return spath;
 }
 
-static sys::path
+static std::string
 user_devprofile_directory ()
 {
-       sys::path p(user_config_directory());
-       p /= devprofile_dir_name;
-
-       return p;
+       return Glib::build_filename (user_config_directory(), devprofile_dir_name);
 }
 
 static bool
@@ -99,8 +91,7 @@ DeviceProfile::reload_device_profiles ()
        vector<string> s;
        vector<string *> *devprofiles;
        PathScanner scanner;
-       SearchPath spath (system_devprofile_search_path());
-       spath += user_devprofile_directory ();
+       SearchPath spath (devprofile_search_path());
 
        devprofiles = scanner (spath.to_string(), devprofile_filter, 0, false, true);
        device_profiles.clear ();
@@ -345,20 +336,20 @@ legalize_for_path (const string& str)
 void
 DeviceProfile::save ()
 {
-       sys::path fullpath = user_devprofile_directory();
+       std::string fullpath = user_devprofile_directory();
 
-       if (g_mkdir_with_parents (fullpath.to_string().c_str(), 0755) < 0) {
-               error << string_compose(_("Session: cannot create user MCP profile folder \"%1\" (%2)"), fullpath.to_string(), strerror (errno)) << endmsg;
+       if (g_mkdir_with_parents (fullpath.c_str(), 0755) < 0) {
+               error << string_compose(_("Session: cannot create user MCP profile folder \"%1\" (%2)"), fullpath, strerror (errno)) << endmsg;
                return;
        }
 
-       fullpath /= legalize_for_path (_name) + ".profile";
+       fullpath = Glib::build_filename (fullpath, legalize_for_path (_name) + ".profile");
        
        XMLTree tree;
        tree.set_root (&get_state());
 
-       if (!tree.write (fullpath.to_string())) {
-               error << string_compose ("MCP profile not saved to %1", fullpath.to_string()) << endmsg;
+       if (!tree.write (fullpath)) {
+               error << string_compose ("MCP profile not saved to %1", fullpath) << endmsg;
        }
 }