Skip to content

Commit

Permalink
iotjs: Add modules path option
Browse files Browse the repository at this point in the history
Change-Id: I1cc40989e45527c40d96838f12652610f7abbf85
Forwarded: #2360
Signed-off-by: Philippe Coval <p.coval@samsung.com>
  • Loading branch information
rzr committed Oct 22, 2018
1 parent ef97d04 commit 4b56517
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/examples/iotjs_startup/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions apps/examples/iotjs_startup/iotjs_startup_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4b56517

Please sign in to comment.