mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-27 12:21:51 -08:00
fix possible problem with QML auto-reload on desktop
This commit is contained in:
parent
6bb056f1f0
commit
c8568493ce
3 changed files with 59 additions and 45 deletions
|
|
@ -13,17 +13,22 @@
|
|||
(let ((secs 0)
|
||||
files)
|
||||
(defun watch-files ()
|
||||
(unless files
|
||||
(dolist (file (directory (merge-pathnames "../../qml/**/*.qml" *dir*)))
|
||||
(push file files)))
|
||||
(let ((curr 0))
|
||||
(dolist (file files)
|
||||
(incf curr (file-write-date file)))
|
||||
(when (/= secs curr)
|
||||
(unless (zerop secs)
|
||||
(qml:reload))
|
||||
(setf secs curr)))
|
||||
(qsingle-shot 250 'watch-files)))
|
||||
(flet ((repeat ()
|
||||
(qsingle-shot 500 'watch-files)))
|
||||
(unless files
|
||||
(dolist (file (directory (merge-pathnames "../../qml/**/*.qml" *dir*)))
|
||||
(push file files)))
|
||||
(let ((curr 0))
|
||||
(dolist (file files)
|
||||
(let ((date (file-write-date file)))
|
||||
(unless date ; might be NIL while saving
|
||||
(return-from watch-files (repeat)))
|
||||
(incf curr date)))
|
||||
(when (/= secs curr)
|
||||
(unless (zerop secs)
|
||||
(qml:reload))
|
||||
(setf secs curr)))
|
||||
(repeat))))
|
||||
|
||||
(watch-files)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue