diff options
| author | Scott Shawcroft <scott@chickadee.tech> | 2017-08-10 15:46:17 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@chickadee.tech> | 2017-08-10 15:46:17 -0700 |
| commit | f6a702538a0b3dd72879d65e3acc32520d4371f5 (patch) | |
| tree | 9458c2136d681a962dbc88c2ab592404abafcc18 /py/modio.c | |
| parent | 5c32a5aa6a9ab207235db340576bdc6a8ed81225 (diff) | |
py: Pretend frozen files are stored under .frozen rather than the empty path.
This makes it clear when frozen modules are loaded as opposed to the empty path
which represents the current working directory. Furthermore, by splitting the two
apart this allows one to control in what order frozen modules are loaded.
This is a prerequisite for #56.
Diffstat (limited to 'py/modio.c')
| -rw-r--r-- | py/modio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/modio.c b/py/modio.c index 2d317d022..b6770194a 100644 --- a/py/modio.c +++ b/py/modio.c @@ -164,14 +164,14 @@ STATIC mp_obj_t resource_stream(mp_obj_t package_in, mp_obj_t path_in) { const char *path = mp_obj_str_get_data(path_in, &len); vstr_add_strn(&path_buf, path, len); - len = path_buf.len; - const char *data = mp_find_frozen_str(path_buf.buf, &len); + size_t file_len; + const char *data = mp_find_frozen_str(path_buf.buf, path_buf.len, &file_len); if (data != NULL) { mp_obj_stringio_t *o = m_new_obj(mp_obj_stringio_t); o->base.type = &mp_type_bytesio; o->vstr = m_new_obj(vstr_t); - vstr_init_fixed_buf(o->vstr, len + 1, (char*)data); - o->vstr->len = len; + vstr_init_fixed_buf(o->vstr, file_len + 1, (char*)data); + o->vstr->len = file_len; o->pos = 0; return MP_OBJ_FROM_PTR(o); } |
