main
Matthew Butterick 4 years ago
parent ebfbb77e62
commit cc7ebba480

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

Loading…
Cancel
Save