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.
This commit is contained in:
parent
7b5400134b
commit
859596ce25
|
@ -542,8 +542,12 @@ int pyexec_file(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int pyexec_file_if_exists(const char *filename) {
|
int pyexec_file_if_exists(const char *filename) {
|
||||||
mp_import_stat_t stat = mp_import_stat(filename);
|
#if MICROPY_MODULE_FROZEN
|
||||||
if (stat != MP_IMPORT_STAT_FILE) {
|
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 1; // success (no file is the same as an empty file executing without fail)
|
||||||
}
|
}
|
||||||
return pyexec_file(filename);
|
return pyexec_file(filename);
|
||||||
|
|
Loading…
Reference in New Issue