diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-07-28 13:29:47 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2018-07-28 13:29:47 -0400 |
| commit | f48b70050e3e4122eaae3eee47d35fc30bda2a4c (patch) | |
| tree | 7d2dacc3c137276e9d0838b571c84c09e78acc42 /py/frozenmod.c | |
| parent | bc760dd34100099c352a0f185ec54ceae23d036d (diff) | |
merge finished
Diffstat (limited to 'py/frozenmod.c')
| -rw-r--r-- | py/frozenmod.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/py/frozenmod.c b/py/frozenmod.c index 5464d0af9..a9143b582 100644 --- a/py/frozenmod.c +++ b/py/frozenmod.c @@ -43,8 +43,14 @@ extern const char mp_frozen_str_names[]; extern const uint32_t mp_frozen_str_sizes[]; extern const char mp_frozen_str_content[]; -// On input, *len contains size of name, on output - size of content +// str_len is length of str. *len is set on on output to size of content const char *mp_find_frozen_str(const char *str, size_t str_len, size_t *len) { + // If the frozen module pseudo dir (e.g., ".frozen/") is a prefix of str, remove it. + if (strncmp(str, MP_FROZEN_FAKE_DIR_SLASH, MP_FROZEN_FAKE_DIR_SLASH_LENGTH) == 0) { + str = str + MP_FROZEN_FAKE_DIR_SLASH_LENGTH; + str_len = str_len - MP_FROZEN_FAKE_DIR_SLASH_LENGTH; + } + const char *name = mp_frozen_str_names; size_t offset = 0; |
