Skip to content

Commit d867ec6

Browse files
committed
fix: Empty config and user path when calling updateOptions
1 parent f44e2e4 commit d867ec6

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/openzwave-driver.cc

+26-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ NAN_METHOD(OZW::UpdateOptions)
7171
CheckMinArgs(1, "info");
7272

7373
OZW *self = ObjectWrap::Unwrap<OZW>(info.This());
74-
::std::string ozw_userpath;
75-
::std::string ozw_config_path;
74+
::std::string ozw_userpath = self->userpath;
75+
::std::string ozw_config_path = self->config_path;
7676

7777
::std::string option_overrides;
7878
bool log_initialisation = true;
@@ -90,6 +90,10 @@ NAN_METHOD(OZW::UpdateOptions)
9090
::std::string keyname = *Nan::Utf8String(key);
9191
Local<Value> argval = Nan::Get(opts, key).ToLocalChecked();
9292
::std::string argvalstr = *Nan::Utf8String(argval);
93+
94+
if(argvalstr.empty())
95+
continue;
96+
9397
// UserPath is directly passed to Manager->Connect()
9498
// scan for OpenZWave options.xml in the nodeJS module's '/config' subdirectory
9599
if (keyname == "UserPath")
@@ -116,6 +120,26 @@ NAN_METHOD(OZW::UpdateOptions)
116120
self->userpath = ozw_userpath;
117121
self->option_overrides = option_overrides;
118122
self->log_initialisation = log_initialisation;
123+
124+
if (self->log_initialisation) {
125+
::std::ostringstream versionstream;
126+
127+
versionstream << ozw_vers_major << "." << ozw_vers_minor << "." << ozw_vers_revision;
128+
::std::cout << "Initialising OpenZWave " << versionstream.str() << " binary addon for Node.JS.\n";
129+
130+
#if OPENZWAVE_SECURITY == 1
131+
::std::cout << "\tOpenZWave Security API is ENABLED\n";
132+
#else
133+
::std::cout << "\tSecurity API not found, using legacy BeginControllerCommand() instead\n";
134+
#endif
135+
136+
::std::cout << "\tZWave device db : " << ozw_config_path << "\n";
137+
::std::cout << "\tUser settings path : " << ozw_userpath << "\n";
138+
if (option_overrides.length() > 0) {
139+
::std::cout << "\tOption Overrides :" << option_overrides << "\n";
140+
}
141+
}
142+
119143
}
120144

121145
// ===================================================================

0 commit comments

Comments
 (0)