main.cpp: Catch exceptions when calling filesystem functions on node.js

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-12-05 18:25:10 +01:00
parent 64ef5e60ff
commit dc380c8dcb
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 4 additions and 2 deletions

View File

@ -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());