[WASMFS] Workaround for missing directory rename in OPFS#24227
[WASMFS] Workaround for missing directory rename in OPFS#24227rickg-hcl wants to merge 6 commits intoemscripten-core:mainfrom
Conversation
|
Could you update the PR title and description with something a little more descriptive? Is there an open bug for this fix? |
|
I updated the description. This is a "fix" for #24162 in that it works around the missing directory rename functionality in opfs. |
|
Can you please update the PR description to describe the problem (e.g. the reason the backend does not already support directory renames) and the solution (e.g. what you are doing in the workaround and what limitations the approach might have)? That will help contextualize the code for review. |
|
updated description and refreshed branch |
|
@tlively Is there any chance of this merging ever? Should we just keep this for our private use until OPFS supports directory rename? |
|
I think it is also possible to use the FileSystemHandle.move() for directories, instead of copy and unlink now .. Or, it is not supported by chrome just yet: https://caniuse.com/mdn-api_filesystemhandle_move |
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.