unwrap_or eagerly evaluates the or case, so in WASM we were getting the "no current directory" error even when we pass Some working_dir, since current_dir() was returning an Err.
By switching this to a match the None case is only evaluated if needed, and by passing working_dir we avoid evaluating current_dir().
unwrap_or
eagerly evaluates the or case, so in WASM we were getting the "no current directory" error even when we pass Someworking_dir
, sincecurrent_dir()
was returning anErr
.By switching this to a match the
None
case is only evaluated if needed, and by passingworking_dir
we avoid evaluatingcurrent_dir()
.