When saving flash file, ask whether to overwrite existing file

This commit is contained in:
Joerg Wunsch
2024-03-30 17:28:52 +01:00
parent 76d54804c7
commit e332c4c818

View File

@@ -713,6 +713,14 @@ class adgui(QObject):
else:
self.log("Internal error: cannot determine file format", ad.MSG_ERROR)
return
fname = self.flashname
p = pathlib.Path(fname)
if p.is_file():
result = QMessageBox.question(self.memories,
f"Overwrite {fname}?",
f"Do you want to overwrite {fname}?")
if result != QMessageBox.StandardButton.Yes:
return
amnt = ad.fileio(ad.FIO_WRITE, self.flashname, fmt, self.dev, "flash", -1)
self.log(f"Wrote {amnt} bytes to {self.flashname}")