From 8a28033587bebaafa2d52c0f58c4a9ee1741c058 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 24 Apr 2025 15:54:22 -0700 Subject: [PATCH] Always set current working dir PR #10263 moved it to only before code.py. This breaks the repl (and likely boot.py.) Fixes #10289 --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 00f6d6aa9e643..eefc081f33cc8 100644 --- a/main.c +++ b/main.c @@ -203,6 +203,9 @@ static void start_mp(safe_mode_t safe_mode) { mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib)); mp_obj_list_init((mp_obj_list_t *)mp_sys_argv, 0); + + // Always return to root + common_hal_os_chdir("/"); } static void stop_mp(void) { @@ -457,8 +460,6 @@ static bool __attribute__((noinline)) run_code_py(safe_mode_t safe_mode, bool *s usb_setup_with_vm(); #endif - // Always return to root before trying to run files. - common_hal_os_chdir("/"); // Check if a different run file has been allocated if (next_code_configuration != NULL) { next_code_configuration->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET;