diff --git a/apps/examples/iotjs_startup/Kconfig b/apps/examples/iotjs_startup/Kconfig index a684f9c707..9a9272f047 100644 --- a/apps/examples/iotjs_startup/Kconfig +++ b/apps/examples/iotjs_startup/Kconfig @@ -27,6 +27,12 @@ config EXAMPLES_IOTJS_STARTUP_JS_FILE ---help--- This is the name of the javascript loaded by IoT.js runtime +config EXAMPLES_IOTJS_EXTRA_MODULE_PATH + string "Directories used for external modules lookup" + default "/rom/example/iotjs_modules" + ---help--- + This is the name of the javascript loaded by IoT.js runtime + config EXAMPLES_IOTJS_STARTUP_WIFI bool "Connect WiFi" select WIFI_MANAGER diff --git a/apps/examples/iotjs_startup/iotjs_startup_main.c b/apps/examples/iotjs_startup/iotjs_startup_main.c index dc0a4e4a53..cca739193f 100644 --- a/apps/examples/iotjs_startup/iotjs_startup_main.c +++ b/apps/examples/iotjs_startup/iotjs_startup_main.c @@ -26,6 +26,10 @@ #define CONFIG_EXAMPLES_IOTJS_STARTUP_JS_FILE "/rom/example/index.js" #endif +#ifndef CONFIG_EXAMPLES_IOTJS_EXTRA_MODULE_PATH +#define CONFIG_EXAMPLES_IOTJS_EXTRA_MODULE_PATH "/rom/example/iotjs_modules" +#endif + #ifndef CONFIG_EXAMPLES_IOTJS_STARTUP_WIFI_SSID #define CONFIG_EXAMPLES_IOTJS_STARTUP_WIFI_SSID "public" #endif @@ -112,6 +116,7 @@ int main(int argc, FAR char *argv[]) int iotjs_startup_main(int argc, char *argv[]) #endif { + setenv("IOTJS_EXTRA_MODULE_PATH", CONFIG_EXAMPLES_IOTJS_EXTRA_MODULE_PATH, 1); chdir(dirname(CONFIG_EXAMPLES_IOTJS_STARTUP_JS_FILE)); char *targv[] = { "iotjs", CONFIG_EXAMPLES_IOTJS_STARTUP_JS_FILE }; int targc = 2;