adjust 'bitmap' so that it saves paths as a list of strings that
get interpreted as a collection at runtime, instead of saving a path. closes PR 12548
This commit is contained in:
parent
2ca0473f1c
commit
6633387827
|
@ -1260,7 +1260,7 @@
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ arg)
|
[(_ arg)
|
||||||
(let* ([arg (syntax->datum #'arg)]
|
(let* ([arg (syntax->datum #'arg)]
|
||||||
[path
|
[path/lst
|
||||||
(cond
|
(cond
|
||||||
[(and (pair? arg)
|
[(and (pair? arg)
|
||||||
(eq? (car arg) 'planet))
|
(eq? (car arg) 'planet))
|
||||||
|
@ -1282,7 +1282,7 @@
|
||||||
(format "could not find ~s, expected it to be in ~a"
|
(format "could not find ~s, expected it to be in ~a"
|
||||||
arg candidate)
|
arg candidate)
|
||||||
stx))
|
stx))
|
||||||
candidate]))]
|
(cons fn colls)]))]
|
||||||
[(string? arg)
|
[(string? arg)
|
||||||
(path->complete-path
|
(path->complete-path
|
||||||
arg
|
arg
|
||||||
|
@ -1292,14 +1292,19 @@
|
||||||
'bitmap
|
'bitmap
|
||||||
"expected the argument to specify a local path (via a string) or a module path (e.g. `icons/b-run.png')"
|
"expected the argument to specify a local path (via a string) or a module path (e.g. `icons/b-run.png')"
|
||||||
stx)])])
|
stx)])])
|
||||||
#`(bitmap/proc #,path))]))
|
#`(bitmap/proc '#,path/lst))]))
|
||||||
|
|
||||||
(define (bitmap/proc arg)
|
(define (bitmap/proc arg)
|
||||||
(when (and (path? arg)
|
(define pth (if (path? arg)
|
||||||
(not (file-exists? arg)))
|
arg
|
||||||
(error 'bitmap "could not find the file ~a" (path->string arg)))
|
(apply collection-file-path arg
|
||||||
|
#:fail
|
||||||
|
(λ (msg) (error 'bitmap msg)))))
|
||||||
|
(when (and (path? pth)
|
||||||
|
(not (file-exists? pth)))
|
||||||
|
(error 'bitmap "could not find the file ~a" (path->string pth)))
|
||||||
;; the rotate does a coercion to a 2htdp/image image
|
;; the rotate does a coercion to a 2htdp/image image
|
||||||
(rotate 0 (make-object image-snip% (make-object bitmap% arg 'unknown/alpha))))
|
(rotate 0 (make-object image-snip% (make-object bitmap% pth 'unknown/alpha))))
|
||||||
|
|
||||||
(define/chk (bitmap/url string)
|
(define/chk (bitmap/url string)
|
||||||
;; the rotate does a coercion to a 2htdp/image image
|
;; the rotate does a coercion to a 2htdp/image image
|
||||||
|
|
Loading…
Reference in New Issue
Block a user