mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
Fix handling of format profiles in system config dirs. (Some profiles could now be shipped with Ardour)
git-svn-id: svn://localhost/ardour2/branches/3.0@3976 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3d47c31d8f
commit
5fa6ed1966
1 changed files with 26 additions and 18 deletions
|
|
@ -60,19 +60,14 @@ ExportProfileManager::ExportProfileManager (Session & s) :
|
||||||
|
|
||||||
/* Initialize path variables */
|
/* Initialize path variables */
|
||||||
|
|
||||||
sys::path path;
|
|
||||||
|
|
||||||
export_config_dir = user_config_directory();
|
export_config_dir = user_config_directory();
|
||||||
export_config_dir /= "export";
|
export_config_dir /= "export";
|
||||||
search_path += export_config_dir;
|
search_path += export_config_dir;
|
||||||
|
|
||||||
path = ardour_search_path().to_string();
|
search_path += ardour_search_path().add_subdirectory_to_paths("export");
|
||||||
path /= "export";
|
search_path += system_config_search_path().add_subdirectory_to_paths("export");;
|
||||||
search_path += path;
|
|
||||||
|
|
||||||
path = system_config_search_path().to_string();
|
std::cout << "search_path: " << search_path.to_string () << std::endl;
|
||||||
path /= "export";
|
|
||||||
search_path += path;
|
|
||||||
|
|
||||||
/* create export config directory if necessary */
|
/* create export config directory if necessary */
|
||||||
|
|
||||||
|
|
@ -480,18 +475,30 @@ ExportProfileManager::save_format_to_disk (FormatPtr format)
|
||||||
/* Check if format is on disk already */
|
/* Check if format is on disk already */
|
||||||
FileMap::iterator it;
|
FileMap::iterator it;
|
||||||
if ((it = format_file_map.find (format->id())) != format_file_map.end()) {
|
if ((it = format_file_map.find (format->id())) != format_file_map.end()) {
|
||||||
/* Update data */
|
|
||||||
{
|
/* Check if config is not in user config dir */
|
||||||
|
if (it->second.branch_path().to_string().compare (export_config_dir.to_string())) {
|
||||||
|
|
||||||
|
/* Write new file */
|
||||||
|
|
||||||
|
XMLTree tree (new_path.to_string());
|
||||||
|
tree.set_root (&format->get_state());
|
||||||
|
tree.write();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Update file and rename if necessary */
|
||||||
|
|
||||||
XMLTree tree (it->second.to_string());
|
XMLTree tree (it->second.to_string());
|
||||||
tree.set_root (&format->get_state());
|
tree.set_root (&format->get_state());
|
||||||
tree.write();
|
tree.write();
|
||||||
|
|
||||||
|
if (new_name.compare (it->second.leaf())) {
|
||||||
|
sys::rename (it->second, new_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rename if necessary */
|
it->second = new_path;
|
||||||
|
|
||||||
if (new_name.compare (it->second.leaf())) {
|
|
||||||
sys::rename (it->second, new_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Write new file */
|
/* Write new file */
|
||||||
|
|
@ -612,12 +619,13 @@ ExportProfileManager::load_format_from_disk (PBD::sys::path const & path)
|
||||||
{
|
{
|
||||||
XMLTree const tree (path.to_string());
|
XMLTree const tree (path.to_string());
|
||||||
FormatPtr format = handler->add_format (*tree.root());
|
FormatPtr format = handler->add_format (*tree.root());
|
||||||
format_list->push_back (format);
|
|
||||||
|
|
||||||
/* Handle id to filename mapping */
|
/* Handle id to filename mapping and don't add duplicates to list */
|
||||||
|
|
||||||
FilePair pair (format->id(), path);
|
FilePair pair (format->id(), path);
|
||||||
format_file_map.insert (pair);
|
if (format_file_map.insert (pair).second) {
|
||||||
|
format_list->push_back (format);
|
||||||
|
}
|
||||||
|
|
||||||
FormatListChanged ();
|
FormatListChanged ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue