blob: 34d9465a2e6891cce3451e9ce2825cf8f2a6870e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
(defun save-exe (path string)
(let* ((fbuf (file-get-buf txr-exe-path))
(bs (make-buf-stream fbuf))
(pre (progn
(stream-set-prop bs :byte-oriented t)
(scan-until-match #/@\(txr\)/ bs)))
(sbuf (ffi-put string (ffi (zarray 128 char)))))
(unless pre
(throwf 'error "~s: ~a isn't a TXR executable" 'save-txr-exe path))
(put-buf sbuf 0 bs)
(file-put-buf path fbuf)
(chmod path #o766)))
|