Reset cwd before looking for files to run#8296
Conversation
Make sure we only look for the files in the root directory.
dhalbert
left a comment
There was a problem hiding this comment.
This doesn't reset the current directory until code.py is run, after. The current directory should probably be reset for boot.py, safemode.py, and code.py. So I think it should be reset in start_mp(). Or should it not be reset between boot.py and code.py? That's something to ponder, about whether to make boot.py be able to change the current directory in a sticky way.
Also, if the filesystem is not working, I think chdir() may throw an error. Maybe better to check with filesystem_present() before claling it.
|
There is no way to change the directory before I don't see the |
|
Good point about To fake not having a filesystem, temporarily add a |
|
When I do that, I get: No crash. |
|
So it never gets to running the code.py that's good. |
dhalbert
left a comment
There was a problem hiding this comment.
My concerns (some incorrect) all accounted for. Thanks!
|
There is still the case when someone uses chdir in boot.py and the board goes into safe mode and runs the wrong safemode.py, but I think that's a self-inflicted wound? |
|
|
safemode.py is run after a hard reset, so I think that cannot happen? |
|
Excellent. |
Make sure we only look for the files in the root directory.
Fixes #8295