Reset cwd before looking for files to run

Make sure we only look for the files in the root directory.
This commit is contained in:
Radomir Dopieralski 2023-08-18 22:05:29 +02:00
parent fc13fba6e5
commit 1a47c5f326

5
main.c
View File

@ -68,6 +68,8 @@
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/supervisor/Runtime.h"
#include "shared-bindings/os/__init__.h"
#if CIRCUITPY_ALARM
#include "shared-bindings/alarm/__init__.h"
#endif
@ -408,6 +410,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
usb_setup_with_vm();
#endif
// Make sure we are in the root directory before looking at files.
common_hal_os_chdir("/");
// Check if a different run file has been allocated
if (next_code_allocation) {
next_code_info_t *info = ((next_code_info_t *)next_code_allocation->ptr);