add hack to make 'unzip' work on iOS

This commit is contained in:
pls.153 2022-11-30 09:59:35 +01:00
parent ac9d2ebf07
commit 5644bded34
3 changed files with 26 additions and 2 deletions

View file

@ -100,6 +100,21 @@ it saves uploaded files on the server."
(in-package :qml)
#+ios ;; hack for iOS, where 'read-sequence' doesn't update 'file-position'
(progn
(ext:package-lock :common-lisp nil)
(defvar cl-user::%read-sequence% (symbol-function 'cl:read-sequence))
(defun cl:read-sequence (buffer stream &rest arguments)
(let ((p1 (file-position stream))
(p2 (apply cl-user::%read-sequence% buffer stream arguments)))
(when p1
(file-position stream (+ p1 p2))) ; update manually
p2))
(ext:package-lock :common-lisp t))
(defun zip (zip-file directory)
"Creates a *.zip file of passed directory, _not_ including the directory name."
(zip:zip (merge-pathnames zip-file)