From 3bee3cfeadcb57833a90c7789333750676f39e81 Mon Sep 17 00:00:00 2001 From: Robert Ou Date: Wed, 15 Nov 2017 03:14:14 -0800 Subject: Mount NODEFS if using emscripten and nodejs Mounts root directory on `/hostfs` and the current working directory on `/hostcwd` --- icetime/icetime.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'icetime') diff --git a/icetime/icetime.cc b/icetime/icetime.cc index 0b7cea2..f9e0994 100644 --- a/icetime/icetime.cc +++ b/icetime/icetime.cc @@ -33,6 +33,10 @@ #include #include +#ifdef __EMSCRIPTEN__ +#include +#endif + // add this number of ns as estimate for clock distribution mismatch #define GLOBAL_CLK_DIST_JITTER 0.1 @@ -2223,6 +2227,18 @@ void help(const char *cmd) int main(int argc, char **argv) { +#ifdef __EMSCRIPTEN__ + EM_ASM( + if (ENVIRONMENT_IS_NODE) + { + FS.mkdir('/hostcwd'); + FS.mount(NODEFS, { root: '.' }, '/hostcwd'); + FS.mkdir('/hostfs'); + FS.mount(NODEFS, { root: '/' }, '/hostfs'); + } + ); +#endif + bool listnets = false; bool print_timing = false; bool interior_timing = false; -- cgit v1.2.3