From dc380c8dcb039d347d17fa412bfbf4b50ded74a7 Mon Sep 17 00:00:00 2001 From: Username404 Date: Mon, 5 Dec 2022 18:25:10 +0100 Subject: [PATCH] main.cpp: Catch exceptions when calling filesystem functions on node.js Signed-off-by: Username404 --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b5597c6..8cc182b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,8 +59,10 @@ int main(int argc, char* argv[]) { if ((typeof process !== 'undefined') && (process.release.name === 'node')) { const sub_directory = UTF8ToString($0); if (!FS.isMountpoint(sub_directory)) { - FS.mkdir(sub_directory); - FS.mount(NODEFS, {root: sub_directory}, sub_directory); + try { + FS.mkdir(sub_directory); + FS.mount(NODEFS, {root: sub_directory}, sub_directory); + } catch (exception) {} }; } }, sub_directory.c_str());