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)

View file

@ -4,13 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body { color: #505050; font-family: sans-serif; margin: 30px 20px; }
body { color: #303030; font-family: sans-serif; margin: 30px 20px; }
a:link, a:visited { text-decoration: none; color: blue; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h3>Upload files to REPL app</h3>
<h3>File exchange with REPL app</h3>
<form enctype="multipart/form-data" method="post" action="/">
<p>
<small><b>Whole Directory</b> (recursive in Firefox/Chromium)</small>
@ -36,6 +36,7 @@
<li>files on the device can be zipped before downloading with
<br><code>(zip "all.zip" "examples/") ; android</code>
<br><code>(zip "all.zip" "../Documents/examples/") ; iOS</code>
<br>&nbsp;
<br>and downloaded like so:
<br><code>http://192.168.1.x:1701/all.zip</code>
</ul>

View file

@ -66,3 +66,11 @@ Windows note
The Windows version is only meant to run on the desktop, using the (free) MSVC
compiler. Please see [readme-windows](readme-windows.md) for details.
Known issues
------------
* on **iOS**, functions `read-sequence`, `read-char` etc. don't update
`file-position` (ECL bug?); for a workaround see hack
[here](examples/cl-repl/lisp/upload-download.lisp)