File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -216,8 +216,14 @@ def save_file(self):
216
216
# Overwrite existing file
217
217
content = self .text_edit .toPlainText ()
218
218
try :
219
- with open (self .current_file_path , "w" , encoding = "utf-8" ) as file :
220
- file .write (content )
219
+ reply = QMessageBox .question (self , "Confirm File Overwrite" ,
220
+ f"You are about to overwrite:{ self .current_file_path } "
221
+ f"This will permanently replace the existing file. Are you sure you want to continue?" ,
222
+ QMessageBox .StandardButton .Yes ,
223
+ QMessageBox .StandardButton .No )
224
+ if reply == QMessageBox .StandardButton .Yes :
225
+ with open (self .current_file_path , "w" , encoding = "utf-8" ) as file :
226
+ file .write (content )
221
227
except Exception as e :
222
228
QMessageBox .critical (self , "Error" , f"Failed to save file: { str (e )} " )
223
229
else :
You can’t perform that action at this time.
0 commit comments