Skip to content

Commit 77a4e42

Browse files
committed
Always chdir back to root when reloading
1 parent 9ab8831 commit 77a4e42

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,6 @@ STATIC bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s
473473
usb_setup_with_vm();
474474
#endif
475475

476-
// Make sure we are in the root directory before looking at files.
477-
common_hal_os_chdir("/");
478-
479476
// Check if a different run file has been allocated
480477
if (next_code_configuration != NULL) {
481478
next_code_configuration->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;
@@ -1112,6 +1109,10 @@ int __attribute__((used)) main(void) {
11121109
serial_write_compressed(MP_ERROR_TEXT("soft reboot\n"));
11131110
}
11141111
simulate_reset = false;
1112+
1113+
// Always return to root before trying to run files.
1114+
common_hal_os_chdir("/");
1115+
11151116
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
11161117
// If code.py did a fake deep sleep, pretend that we
11171118
// are running code.py for the first time after a hard

0 commit comments

Comments
 (0)