+ // sanity check file name first
+ string filepath = file_entry.get_text();
+ struct stat statbuf;
+
+ if (filepath.empty()) {
+ // warning dialog
+ string txt = _("Please enter a valid filename.");
+ MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+ msg.run();
+ return;
+ }
+
+ // check if file exists already and warn
+ if (stat (filepath.c_str(), &statbuf) == 0) {
+ if (S_ISDIR (statbuf.st_mode)) {
+ string txt = _("Please specify a complete filename for the audio file.");
+ MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+ msg.run();
+ return;
+ }
+ else {
+ string txt = _("File already exists, do you want to overwrite it?");
+ MessageDialog msg (*this, txt, false, MESSAGE_QUESTION, BUTTONS_YES_NO, true);
+ //ArdourMessage msg (this, X_("exportoverwrite"), txt, true, false, Gtk::BUTTONS_YES_NO);
+ if ((ResponseType) msg.run() == Gtk::RESPONSE_NO) {
+ return;
+ }
+ }
+ }
+
+ // directory needs to exist and be writable
+ string dirpath = PBD::dirname (filepath);
+ if (::access (dirpath.c_str(), W_OK) != 0) {
+ string txt = _("Cannot write file in: ") + dirpath;
+ MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+ msg.run();
+ return;
+ }
+
+ if (cue_file_combo.get_active_text () != _("None")) {
+ do_export_cd_markers (file_entry.get_text(), cue_file_combo.get_active_text ());