diff src/name/blackcap/exifwasher/WashDialog.kt @ 11:e52fd1a575de

Add Mac icons.
author David Barts <n5jrn@me.com>
date Fri, 10 Apr 2020 20:58:03 -0700
parents 0a106e9b91b4
children 841f711c40bd
line wrap: on
line diff
--- a/src/name/blackcap/exifwasher/WashDialog.kt	Fri Apr 10 19:29:58 2020 -0700
+++ b/src/name/blackcap/exifwasher/WashDialog.kt	Fri Apr 10 20:58:03 2020 -0700
@@ -153,6 +153,19 @@
         val (name, ext) = splitext(washing.name)
         var newFile = File(outDir, "${name}_washed${ext}")
 
+        /* warn (and allow user to back out) if overwriting */
+        if (newFile.exists()) {
+            val answer = JOptionPane.showConfirmDialog(Application.mainFrame,
+                "File ${newFile.name} already exists. Overwrite?",
+                "Confirm overwriting file",
+                JOptionPane.YES_NO_OPTION,
+                JOptionPane.WARNING_MESSAGE)
+            if (answer != JOptionPane.YES_OPTION) {
+                close()
+                return
+            }
+        }
+
         /* copy the file, then edit the Exif in the copy */
         useWaitCursor()
         swingWorker<Boolean> {