+bool
+Editor::process_midi_export_dialog (MidiExportDialog& dialog, boost::shared_ptr<MidiRegion> midi_region)
+{
+ string path = dialog.get_path ();
+
+ if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
+ bool overwrite = ARDOUR_UI_UTILS::overwrite_file_dialog (dialog,
+ _("Confirm MIDI File Overwrite"),
+ _("A file with the same name already exists. Do you want to overwrite it?"));
+
+ if (!overwrite) {
+ return false;
+ }
+
+ /* force ::g_unlink because the backend code will
+ go wrong if it tries to open an existing
+ file for writing.
+ */
+ ::g_unlink (path.c_str());
+ }
+
+ return midi_region->do_export (path);
+}
+