summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-06-30 16:00:53 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-07-01 13:10:05 +0200
commit5b1cc2d1fca222a49d61a2a1a7333e356f3c23de (patch)
treefef121e8135a02cf19757fcd77fed35f70045196
parent719609522a30fa9e3b96b028ac5a1d1a65f1678f (diff)
Fix FS error on JS startup due to existing folder.
-rw-r--r--platform/javascript/javascript_main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index fd61c46e63..f7f2016d3c 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -86,6 +86,11 @@ extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {
}
int main(int argc, char *argv[]) {
+ // Create and mount userfs immediately.
+ EM_ASM({
+ FS.mkdir('/userfs');
+ FS.mount(IDBFS, {}, '/userfs');
+ });
os = new OS_JavaScript();
Main::setup(argv[0], argc - 1, &argv[1], false);
emscripten_set_main_loop(main_loop_callback, -1, false);
@@ -95,8 +100,6 @@ int main(int argc, char *argv[]) {
// run the 'main_after_fs_sync' function.
/* clang-format off */
EM_ASM({
- FS.mkdir('/userfs');
- FS.mount(IDBFS, {}, '/userfs');
FS.syncfs(true, function(err) {
requestAnimationFrame(function() {
ccall('main_after_fs_sync', null, ['string'], [err ? err.message : ""]);