-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[WasmFS] Support file embedding #16105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Minor issue, we had code paths that support both passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems stranger to provide parent
but not name
than it would be to provide name
but not parent
. Would it be feasible to standardize in the other direction?
I think of it as |
If it's consistent and idiomatic, then lgtm, but it definitely feels weird! Sometimes the |
Hmm, I looked around a little for an example in our codebase, and can't find one atm... maybe it's not as common as I thought. I'll flip it around as you suggest. |
Oh, I missed the example, which was just a few lines above this, in |
This reverts commit e25d4e7.
@@ -649,7 +649,7 @@ def generate_js(data_target, data_files, metadata): | |||
var content = HEAPU32[start32++]; | |||
var name = UTF8ToString(name_addr) | |||
// canOwn this data in the filesystem, it is a slice of wasm memory that will never change | |||
Module['FS_createDataFile'](undefined, name, HEAP8.subarray(content, content + len), true, true, true); | |||
Module['FS_createDataFile'](name, null, HEAP8.subarray(content, content + len), true, true, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems odd to me too. The way I handled this in #16050 I guess made it work both wasy:
- var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent;
+ var path = name;
+ if (parent) {
+ parent = typeof parent === 'string' ? parent : FS.getPath(parent);
+ path = name ? PATH.join2(parent, name) : parent;
+ }
This practically worked since #16050, but the JS side needs to support a
missing parent, which is how the file packager emits it.
Fixes #16014