Commit 859596ce authored by Andrew Leech's avatar Andrew Leech Committed by Damien George

lib/utils: Make pyexec_file_if_exists run frozen scripts if they exist.

So that boot.py and/or main.py can be frozen (either as STR or MPY) in the
same way that other scripts are frozen.  Frozen scripts have preference to
scripts in the VFS.
parent 7b540013
......@@ -542,8 +542,12 @@ int pyexec_file(const char *filename) {
}
int pyexec_file_if_exists(const char *filename) {
mp_import_stat_t stat = mp_import_stat(filename);
if (stat != MP_IMPORT_STAT_FILE) {
#if MICROPY_MODULE_FROZEN
if (mp_frozen_stat(filename) == MP_IMPORT_STAT_FILE) {
return pyexec_frozen_module(filename);
}
#endif
if (mp_import_stat(filename) != MP_IMPORT_STAT_FILE) {
return 1; // success (no file is the same as an empty file executing without fail)
}
return pyexec_file(filename);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment