diff options
author | Valeriy Kamyshniy <vkamyshniy@wavesglobal.com> | 2015-04-06 21:25:42 +0300 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:10 -0400 |
commit | 1acee680377200164e28090fb073cb01066fdde7 (patch) | |
tree | a1fe2ac5f9926fdfe9f1ebf4386e743af9baf82a /libs | |
parent | 7c5d849247bdd5fdccd5a91bc5f2d38ffc0ada0c (diff) |
[Summary] a) On MAC OS, .DS_Store files are ignored when saving a session by “Save As”.
b) plugins folder is not created for Templates.
[Required review] Paul Davis, YPozdnyakov
Conflicts:
libs/ardour/session_state.cc
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/session_state.cc | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 266096a894..d1e2aa4b68 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2052,14 +2052,17 @@ Session::save_template (string template_name) return -1; } - /* copy plugin state directory */ + if (!ARDOUR::Profile->get_trx()) { + /* copy plugin state directory */ - std::string template_plugin_state_path (Glib::build_filename (template_dir_path, X_("plugins"))); + std::string template_plugin_state_path (Glib::build_filename (template_dir_path, X_("plugins"))); - if (g_mkdir_with_parents (template_plugin_state_path.c_str(), 0755) != 0) { - error << string_compose(_("Could not create directory for Session template plugin state\"%1\" (%2)"), - template_plugin_state_path, g_strerror (errno)) << endmsg; - return -1; + if (g_mkdir_with_parents (template_plugin_state_path.c_str(), 0755) != 0) { + error << string_compose(_("Could not create directory for Session template plugin state\"%1\" (%2)"), + template_plugin_state_path, g_strerror (errno)) << endmsg; + return -1; + } + copy_files (plugins_dir(), template_plugin_state_path); } copy_recurse (plugins_dir(), template_plugin_state_path); @@ -4176,7 +4179,15 @@ Session::save_as (SaveAs& saveas) std::string from = *i; - if ((*i).find (audiofile_dir_string) != string::npos) { +#ifdef __APPLE__ + string filename = Glib::path_get_basename (from); + std::transform (filename.begin(), filename.end(), filename.begin(), ::toupper); + if (filename == ".DS_STORE") { + continue; + } +#endif + + if (from.find (audiofile_dir_string) != string::npos) { /* audio file: only copy if asked */ @@ -4195,7 +4206,7 @@ Session::save_as (SaveAs& saveas) internal_file_cnt++; - } else if ((*i).find (midifile_dir_string) != string::npos) { + } else if (from.find (midifile_dir_string) != string::npos) { /* midi file: always copy unless * creating an empty new session @@ -4216,7 +4227,7 @@ Session::save_as (SaveAs& saveas) internal_file_cnt++; - } else if ((*i).find (analysis_dir_string) != string::npos) { + } else if (from.find (analysis_dir_string) != string::npos) { /* make sure analysis dir exists in * new session folder, but we're not @@ -4235,14 +4246,14 @@ Session::save_as (SaveAs& saveas) bool do_copy = true; for (vector<string>::iterator v = do_not_copy_extensions.begin(); v != do_not_copy_extensions.end(); ++v) { - if (((*i).length() > (*v).length()) && ((*i).find (*v) == (*i).length() - (*v).length())) { + if ((from.length() > (*v).length()) && (from.find (*v) == from.length() - (*v).length())) { /* end of filename matches extension, do not copy file */ do_copy = false; break; } } - if (!saveas.copy_media && (*i).find (peakfile_suffix) != string::npos) { + if (!saveas.copy_media && from.find (peakfile_suffix) != string::npos) { /* don't copy peakfiles if * we're not copying media */ @@ -4250,7 +4261,7 @@ Session::save_as (SaveAs& saveas) } if (do_copy) { - string to = Glib::build_filename (to_dir, (*i).substr (prefix_len)); + string to = Glib::build_filename (to_dir, from.substr (prefix_len)); info << "attempting to make directory/folder " << to << endmsg; @@ -4272,7 +4283,7 @@ Session::save_as (SaveAs& saveas) */ GStatBuf gsb; - g_stat ((*i).c_str(), &gsb); + g_stat (from.c_str(), &gsb); copied += gsb.st_size; cnt++; |