-static std::string
-get_non_existent_filename (DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint channel, uint channels)
-{
- char buf[PATH_MAX+1];
- bool goodfile = false;
- string base(basename);
- const char* ext = (type == DataType::AUDIO) ? "wav" : "mid";
-
- do {
-
- if (type == DataType::AUDIO && channels == 2) {
- if (channel == 0) {
- snprintf (buf, sizeof(buf), "%s-L.wav", base.c_str());
- } else {
- snprintf (buf, sizeof(buf), "%s-R.wav", base.c_str());
- }
- } else if (channels > 1) {
- snprintf (buf, sizeof(buf), "%s-c%d.%s", base.c_str(), channel, ext);
- } else {
- snprintf (buf, sizeof(buf), "%s.%s", base.c_str(), ext);
- }
-
-
- string tempname = destdir + "/" + buf;
- if (!allow_replacing && Glib::file_test (tempname, Glib::FILE_TEST_EXISTS)) {
-
- /* if the file already exists, we must come up with
- * a new name for it. for now we just keep appending
- * _ to basename
- */
-
- base += "_";
-
- } else {
-
- goodfile = true;
- }
-
- } while ( !goodfile);
-
- return buf;
-}
-
-static vector<string>
-get_paths_for_new_sources (const bool allow_replacing, const string& import_file_path, const string& session_dir, uint channels)