cs: avoid crash on startup if the working directory does not exist
Closes #3793
This commit is contained in:
parent
9753eb6fb0
commit
725a7e353c
|
@ -30352,11 +30352,16 @@
|
||||||
(define set-run-file! (lambda (p_0) (set! run-file p_0)))
|
(define set-run-file! (lambda (p_0) (set! run-file p_0)))
|
||||||
(define orig-dir
|
(define orig-dir
|
||||||
(let ((os-host-dir_0
|
(let ((os-host-dir_0
|
||||||
(|#%app|
|
(let ((dir_0
|
||||||
rktio_to_bytes
|
|
||||||
(|#%app|
|
(|#%app|
|
||||||
rktio_get_current_directory
|
rktio_get_current_directory
|
||||||
(unsafe-place-local-ref cell.1)))))
|
(unsafe-place-local-ref cell.1))))
|
||||||
|
(if (vector? dir_0)
|
||||||
|
(let ((tmp_0 (system-path-convention-type)))
|
||||||
|
(if (eq? tmp_0 'unix)
|
||||||
|
#vu8(47)
|
||||||
|
(if (eq? tmp_0 'windows) #vu8(67 58 92) (void))))
|
||||||
|
(|#%app| rktio_to_bytes dir_0)))))
|
||||||
(let ((os-dir_0 (1/path->directory-path (host-> os-host-dir_0))))
|
(let ((os-dir_0 (1/path->directory-path (host-> os-host-dir_0))))
|
||||||
(let ((tmp_0 (system-type 'os)))
|
(let ((tmp_0 (system-type 'os)))
|
||||||
(if (eq? tmp_0 'windows)
|
(if (eq? tmp_0 'windows)
|
||||||
|
|
|
@ -71,7 +71,14 @@
|
||||||
|
|
||||||
(define orig-dir
|
(define orig-dir
|
||||||
(let ()
|
(let ()
|
||||||
(define os-host-dir (rktio_to_bytes (rktio_get_current_directory rktio)))
|
(define os-host-dir (let ([dir (rktio_get_current_directory rktio)])
|
||||||
|
(if (rktio-error? dir)
|
||||||
|
;; If there's an error getting the current directory,
|
||||||
|
;; just use a root directory
|
||||||
|
(case (system-path-convention-type)
|
||||||
|
[(unix) #"/"]
|
||||||
|
[(windows) #"C:\\"])
|
||||||
|
(rktio_to_bytes dir))))
|
||||||
(define os-dir (path->directory-path (host-> os-host-dir)))
|
(define os-dir (path->directory-path (host-> os-host-dir)))
|
||||||
(case (system-type 'os)
|
(case (system-type 'os)
|
||||||
[(windows) os-dir]
|
[(windows) os-dir]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user