From 8c728411db77d0ed578c6a5742d9d71230f3fec6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 14 Aug 2015 01:36:32 +0200 Subject: [PATCH] don't allow save-as to write to an existing dir. --- gtk2_ardour/save_as_dialog.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/save_as_dialog.cc b/gtk2_ardour/save_as_dialog.cc index f696d131eb..2f9c7c517f 100644 --- a/gtk2_ardour/save_as_dialog.cc +++ b/gtk2_ardour/save_as_dialog.cc @@ -105,9 +105,19 @@ SaveAsDialog::no_include_toggled () void SaveAsDialog::name_entry_changed () { - if (!new_name_entry.get_text().empty()) { - set_response_sensitive (RESPONSE_OK); + if (new_name_entry.get_text().empty()) { + set_response_sensitive (RESPONSE_OK, false); + return; } + + std::string dir = Glib::build_filename (new_parent_folder(), new_name_entry.get_text()); + + if (Glib::file_test (dir, Glib::FILE_TEST_EXISTS)) { + set_response_sensitive (RESPONSE_OK, false); + return; + } + + set_response_sensitive (RESPONSE_OK); } string