- /* check for existing wholefile regions of the same name,
- which can happen when we import foo.wav but end up with foo-L.wav
- and foo-R.wav inside the session. this case doesn't trigger
- source name collisions, so we have to catch it at the region
- name level.
- */
-
- string region_name = region_name_from_path (paths.front(), true, false);
-
- if (RegionFactory::wholefile_region_by_name (region_name)) {
- string message = string_compose ( _("You appear to have already imported this file, since a region called %1 already exists.\nDo you really want to import it again?"),
- region_name);
- MessageDialog dialog (message, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, true);
- int ret;
-
- dialog.show ();
- ret = dialog.run ();
- dialog.hide ();
-
- if (ret != RESPONSE_OK) {
- return -1;
- }
-
- int l = 0;
-
- while (RegionFactory::region_by_name (region_name) && ++l < 999) {
- region_name = bump_name_once (region_name, '.');
- }
-
- if (l == 999) {
- error << string_compose (_("Too many regions already named something like \"%1\""), paths.front()) << endmsg;
- return -1;
- }
- }
-