Matthew Butterick 4 years ago
parent 2832abefab
commit ebfbb77e62

@ -334,17 +334,17 @@
;; `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.
(match-define-values (base-dir _ _) (split-path (define base-dir (cond
(cond [base-dir-arg
;; for reasons unclear, DrRacket sometimes sneaks (define-values (dir name _)
;; an "unsaved editor" into this arg, despite efforts to prevent (split-path (match base-dir-arg
;; probably my fault ;; for reasons unclear, DrRacket sometimes sneaks
[(equal? base-dir-arg "unsaved editor") pdf-path-arg] ;; an "unsaved editor" into this arg, despite efforts to prevent
[base-dir-arg] ;; probably my fault
[pdf-path-arg] ["unsaved editor" pdf-path-arg]
;; pdf-path-arg is #false when we're returning bytes, [_ base-dir-arg])))
;; but we still need some directory, so current-directory is last resort. dir]
[else (current-directory)]))) [else (current-directory)]))
(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