Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iotjs: Add modules path option #2360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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