- if (g_mkdir_with_parents (path.c_str(), 0755)) {
- error << string_compose (_("Cannot create route template directory %1"), path) << endmsg;
- return;
+ safe_name = legalize_for_path (name);
+ safe_name += template_suffix;
+
+ path = Glib::build_filename (dir, safe_name);
+
+ if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
+ bool overwrite = overwrite_file_dialog (prompter,
+ _("Confirm Template Overwrite"),
+ _("A template already exists with that name. Do you want to overwrite it?"));
+
+ if (!overwrite) {
+ return false;
+ }