diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-02 11:20:37 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-02 11:20:37 -0400 |
commit | 74bc0c84686c4a85941b98d17179d3209bf9a2a8 (patch) | |
tree | 8b14bd2694fd2c807f455d6ee3330eeb6a3d4033 /libs/ardour/session_state.cc | |
parent | 08a1409b1f5b5558d2eccc28a3ae4cbd44391812 (diff) |
substantive changes to the logic and safety for naming of (audio/MIDI) sources, especially when created via import
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index ffbe55afbf..c985f8810a 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1830,41 +1830,6 @@ Session::get_sources_as_xml () return *node; } -string -Session::path_from_region_name (DataType type, string name, string identifier) -{ - char buf[PATH_MAX+1]; - uint32_t n; - SessionDirectory sdir(get_best_session_directory_for_new_source()); - std::string source_dir = ((type == DataType::AUDIO) - ? sdir.sound_path() : sdir.midi_path()); - - string ext = native_header_format_extension (config.get_native_file_header_format(), type); - - for (n = 0; n < 999999; ++n) { - if (identifier.length()) { - snprintf (buf, sizeof(buf), "%s%s%" PRIu32 "%s", name.c_str(), - identifier.c_str(), n, ext.c_str()); - } else { - snprintf (buf, sizeof(buf), "%s-%" PRIu32 "%s", name.c_str(), - n, ext.c_str()); - } - - std::string source_path = Glib::build_filename (source_dir, buf); - - if (!Glib::file_test (source_path, Glib::FILE_TEST_EXISTS)) { - return source_path; - } - } - - error << string_compose (_("cannot create new file from region name \"%1\" with ident = \"%2\": too many existing files with similar names"), - name, identifier) - << endmsg; - - return ""; -} - - int Session::load_sources (const XMLNode& node) { @@ -2053,7 +2018,7 @@ Session::refresh_disk_space () } string -Session::get_best_session_directory_for_new_source () +Session::get_best_session_directory_for_new_audio () { vector<space_and_path>::iterator i; string result = _session_dir->root_path(); |