@@ -190,30 +190,37 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
190190 char * file_str = vstr_null_terminated_str (file );
191191 #endif
192192
193- // If we support frozen modules (either as str or mpy) then try to find the
194- // requested filename in the list of frozen module filenames.
195- #if MICROPY_MODULE_FROZEN
196- void * modref ;
197- int frozen_type = mp_find_frozen_module (file_str , file -> len , & modref );
198- #endif
193+ #if MICROPY_MODULE_FROZEN || MICROPY_MODULE_FROZEN_MPY
194+ if (strncmp (MP_FROZEN_FAKE_DIR_SLASH ,
195+ file_str ,
196+ MP_FROZEN_FAKE_DIR_SLASH_LENGTH ) == 0 ) {
197+ // If we support frozen modules (either as str or mpy) then try to find the
198+ // requested filename in the list of frozen module filenames.
199+ #if MICROPY_MODULE_FROZEN
200+ void * modref ;
201+ int frozen_type = mp_find_frozen_module (file_str + MP_FROZEN_FAKE_DIR_SLASH_LENGTH , file -> len - MP_FROZEN_FAKE_DIR_SLASH_LENGTH , & modref );
202+ #endif
199203
200- // If we support frozen str modules and the compiler is enabled, and we
201- // found the filename in the list of frozen files, then load and execute it.
202- #if MICROPY_MODULE_FROZEN_STR
203- if (frozen_type == MP_FROZEN_STR ) {
204- do_load_from_lexer (module_obj , modref );
205- return ;
206- }
207- #endif
204+ // If we support frozen str modules and the compiler is enabled, and we
205+ // found the filename in the list of frozen files, then load and execute it.
206+ #if MICROPY_MODULE_FROZEN_STR
207+ if (frozen_type == MP_FROZEN_STR ) {
208+ do_load_from_lexer (module_obj , modref );
209+ return ;
210+ }
211+ #endif
212+
213+ // If we support frozen mpy modules and we found a corresponding file (and
214+ // its data) in the list of frozen files, execute it.
215+ #if MICROPY_MODULE_FROZEN_MPY
216+ if (frozen_type == MP_FROZEN_MPY ) {
217+ do_execute_raw_code (module_obj , modref );
218+ return ;
219+ }
220+ #endif
208221
209- // If we support frozen mpy modules and we found a corresponding file (and
210- // its data) in the list of frozen files, execute it.
211- #if MICROPY_MODULE_FROZEN_MPY
212- if (frozen_type == MP_FROZEN_MPY ) {
213- do_execute_raw_code (module_obj , modref );
214- return ;
215222 }
216- #endif
223+ #endif // MICROPY_MODULE_FROZEN || MICROPY_MODULE_FROZEN_MPY
217224
218225 // If we support loading .mpy files then check if the file extension is of
219226 // the correct format and, if so, load and execute the file.
0 commit comments