[pprzcenter] copy backup file to conf when restoring

and then delete the backup file.
If conf.xml is actually a symlink, simply renaming the file will remove the symlink.
This commit is contained in:
Felix Ruess
2016-04-01 16:15:22 +02:00
parent 4c3ce017f7
commit 8bc6e8699d
+7 -6
View File
@@ -138,14 +138,15 @@ let quit_button_callback = fun gui ac_combo session_combo target_combo ?(confirm
let rec question_box = fun () ->
match GToolbox.question_box ~title:"Quit" ~buttons:["Save changes"; "Discard changes"; "View changes"; "Cancel"] ~default:1 "Configuration changes have not been saved" with
| 2 ->
Sys.rename Utils.backup_xml_file Utils.conf_xml_file;
quit_callback gui ac_combo session_combo target_combo ()
ignore (Sys.command (sprintf "cp %s %s" Utils.backup_xml_file Utils.conf_xml_file));
Sys.remove Utils.backup_xml_file;
quit_callback gui ac_combo session_combo target_combo ()
| 3 ->
ignore (Sys.command (sprintf "meld %s %s" Utils.backup_xml_file Utils.conf_xml_file));
question_box ()
ignore (Sys.command (sprintf "meld %s %s" Utils.backup_xml_file Utils.conf_xml_file));
question_box ()
| 1 ->
Sys.remove Utils.backup_xml_file;
quit_callback gui ac_combo session_combo target_combo ()
Sys.remove Utils.backup_xml_file;
quit_callback gui ac_combo session_combo target_combo ()
| _ -> () in
question_box ()
end else begin