[WASMFS] Workaround for missing directory rename in OPFS #24227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #24162
In September of 2021, we really needed to OPFS for our emscripten app, so we undertook the challenge and built a component that we could integrate into our emscripten fork that would provide OPFS support, but only for the calls that we used. We have been shipping it since July of 2022. We did this because the full emscripten support for OPFS seemed to be taking longer than we could afford.
Recently, we noticed that the WASMFS support had gone from pre-release to ready, so we started evaluating using that instead of our side component. There appears to be only 3 issues blocking us:
#24123
#24141
#24162
The first two of these we can work around. The third is the lack of support in OPFS for renaming directories.
We had implemented a workaround in our side component. It involves just copying the directories and moving the files into them, recursively. This PR is just a port of that workaround into the wasfms structure. if/when OPFS ever supports the move() method on a directory handle, it will be used instead of this workaround with no code change needed.
I’ve tested this PR with our application and it works the same as our original solution.