From 81599b7b49459568047005fd9a37a06dc8d35410 Mon Sep 17 00:00:00 2001 From: polos Date: Fri, 24 Jul 2020 19:30:05 +0200 Subject: [PATCH] revision --- lib/qml-ui-vars.lisp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/qml-ui-vars.lisp b/lib/qml-ui-vars.lisp index 8847f9f..47cae12 100644 --- a/lib/qml-ui-vars.lisp +++ b/lib/qml-ui-vars.lisp @@ -16,8 +16,6 @@ (in-package :qml-ui-variables) -(defparameter *warn-if-exists* nil) - (defparameter *qml-items* (qfind-children qml:*quick-view*)) (defun class-name* (item) @@ -116,18 +114,16 @@ t))) (defun run () - (let ((ui "lisp/ui-vars.lisp")) - (when (and *warn-if-exists* - (probe-file ui) - (/= |QMessageBox.Yes| - (|question.QMessageBox| nil "Replace?" - (format nil "File ~S already exists.
Replace it?" ui) - (logior |QMessageBox.Yes| |QMessageBox.Cancel|)))) - (return-from run)) + (let ((ui "lisp/ui-vars.lisp.try")) (ensure-directories-exist ui) (with-open-file (out ui :direction :output :if-exists :supersede) (if (write-ui-file out) - (format t "~%UI file generated: ~S~%~%" ui) + (progn + (let ((new (subseq ui 0 (- (length ui) #.(length ".try"))))) + (when (probe-file new) + (delete-file new)) + (rename-file ui (file-namestring new)) + (format t "~%UI file generated: ~S~%~%" new))) (format t "~%File not generated, please correct names and try again.~%~%"))))) (run)