|
|
|
@ -334,17 +334,18 @@
|
|
|
|
|
;; `base-dir-arg` is the starting point for resolving any relative pathnames,
|
|
|
|
|
;; and looking for fonts and other assets.
|
|
|
|
|
|
|
|
|
|
(define base-dir (cond
|
|
|
|
|
[base-dir-arg
|
|
|
|
|
(define-values (dir name _)
|
|
|
|
|
(split-path (match base-dir-arg
|
|
|
|
|
(define base-dir (let ([maybe-dir (cond
|
|
|
|
|
;; for reasons unclear, DrRacket sometimes sneaks
|
|
|
|
|
;; an "unsaved editor" into this arg, despite efforts to prevent
|
|
|
|
|
;; an "unsaved editor" into base-dir-arg, despite efforts
|
|
|
|
|
;; probably my fault
|
|
|
|
|
["unsaved editor" pdf-path-arg]
|
|
|
|
|
[_ base-dir-arg])))
|
|
|
|
|
dir]
|
|
|
|
|
[else (current-directory)]))
|
|
|
|
|
[(equal? base-dir-arg "unsaved editor") pdf-path-arg]
|
|
|
|
|
[base-dir-arg]
|
|
|
|
|
[pdf-path-arg]
|
|
|
|
|
[else (current-directory)])])
|
|
|
|
|
(match maybe-dir
|
|
|
|
|
[(? directory-exists? dir) dir]
|
|
|
|
|
[_ (define-values (dir name _) (split-path maybe-dir))
|
|
|
|
|
dir])))
|
|
|
|
|
|
|
|
|
|
(unless (directory-exists? base-dir)
|
|
|
|
|
(raise-argument-error 'render-pdf "existing directory" base-dir))
|
|
|
|
|