-
Notifications
You must be signed in to change notification settings - Fork 39
Remove main file if empty during hex creation #1223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This creates a "clean" MicroPython hex. When the REPL is launched it already includes "from microbit import *".
Preview build will be at |
// Get the project stats after flashing as this will remove the main file if empty. | ||
this.logging.event({ | ||
type: "flash", | ||
detail: await this.projectStats(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs moving, otherwise the first save will include an empty main.py (which is then removed), and subsequent saves will not (unless code is added by the user).
Please can we double check that we don't read main.py from the fs directly anywhere else? |
We read it using FileSystem read, but not using MicropythonFsHex read/readBytes. So this looks safe to me. Hmm did just create an error reloading a hex file though. Moving back to draft to investigate. Update: We can't load a hex file that doesn't have a main.py. The same is true of a blank hex you can create from the V2 editor. I think we should fix as we're adding the ability to create such hex files in this PR. |
The V2 editor also fails to load hex files without python code: Error occurs during call to |
This change also allows the user to create an additional file with content. If |
This creates a "clean" MicroPython hex. When the REPL is launched it already includes "from microbit import *".