Skip to content

Commit

Permalink
Merge pull request #2360 from TizenTeam/sandbox/rzr/iotjs/review/master
Browse files Browse the repository at this point in the history
iotjs: Add modules path option
  • Loading branch information
sunghan-chang authored Oct 24, 2018
2 parents 8234ab5 + 4b56517 commit 8330272
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 8330272

Please sign in to comment.