mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 10:31:34 -08:00
60 lines
1.5 KiB
Common Lisp
60 lines
1.5 KiB
Common Lisp
(in-package :qml)
|
|
|
|
(export
|
|
(list #+android '*shell-output*
|
|
#+android 'shell))
|
|
|
|
;;; add function 'shell' (android only)
|
|
|
|
#+android
|
|
(defvar *shell-output* nil)
|
|
|
|
#+android
|
|
(defun shell (command)
|
|
"Run shell commands; example:
|
|
(shell \"df -h\")"
|
|
(let ((s (ext:run-program "sh" (list "-c" command))))
|
|
(setf *shell-output*
|
|
(loop :for line = (read-line s nil nil)
|
|
:while line :collect line)))
|
|
(princ (x:join *shell-output* #\Newline))
|
|
(values))
|
|
|
|
;;; create default '.eclrc'
|
|
|
|
#+mobile
|
|
(let ((ecl-rc (merge-pathnames ".eclrc")))
|
|
(unless (probe-file ecl-rc)
|
|
(with-open-file (s ecl-rc :direction :output)
|
|
(format s "(x:when-it (probe-file \"settings/colors.lisp\")~
|
|
~% (load x:it))"))))
|
|
|
|
(ignore-errors ; don't hang on startup
|
|
(load (merge-pathnames ".eclrc")))
|
|
|
|
;;; check version
|
|
|
|
#+mobile
|
|
(defconstant +version+ 3)
|
|
|
|
#+mobile
|
|
(let ((.version (merge-pathnames ".version")))
|
|
(when (or (not (probe-file .version))
|
|
(> +version+
|
|
(parse-integer (alexandria:read-file-into-string .version))))
|
|
;; asset files may have changed
|
|
(copy-all-asset-files :keep (list "settings/colors.lisp"))
|
|
(alexandria:write-string-into-file
|
|
(princ-to-string +version+) .version :if-exists :supersede)))
|
|
|
|
;;; hacks
|
|
|
|
;; needed for :sockets (linked as static lib)
|
|
(asdf:defsystem :sb-bsd-sockets)
|
|
|
|
;; eventual ssl libs (not included in LQML) need to be loaded manually
|
|
#+android
|
|
(when (probe-file "libssl.so")
|
|
(ffi:load-foreign-library "libcrypto.so")
|
|
(ffi:load-foreign-library "libssl.so"))
|
|
|