node-sword-interface 0.252.0 → 0.253.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sword-interface",
3
- "version": "0.252.0",
3
+ "version": "0.253.0",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -142,9 +142,9 @@ NodeSwordInterface::NodeSwordInterface(const Napi::CallbackInfo& info) : Napi::O
142
142
  Napi::Env env = info.Env();
143
143
  Napi::HandleScope scope(env);
144
144
 
145
- std::string customHomeDir = "";
146
145
  std::string localeDir = "";
147
- FileSystemHelper fsHelper;
146
+ this->customHomeDir = "";
147
+
148
148
  bool homeDirError = false;
149
149
  bool localeDirError = false;
150
150
 
@@ -153,9 +153,9 @@ NodeSwordInterface::NodeSwordInterface(const Napi::CallbackInfo& info) : Napi::O
153
153
  this->_currentModuleSearchWorker = 0;
154
154
 
155
155
  if (info[0].IsString()) {
156
- customHomeDir = string(info[0].As<Napi::String>());
156
+ this->customHomeDir = string(info[0].As<Napi::String>());
157
157
 
158
- if (!this->dirExists(info, customHomeDir)) {
158
+ if (!this->dirExists(info, this->customHomeDir)) {
159
159
  homeDirError = true;
160
160
  }
161
161
  }
@@ -171,10 +171,10 @@ NodeSwordInterface::NodeSwordInterface(const Napi::CallbackInfo& info) : Napi::O
171
171
  }
172
172
 
173
173
  if (!homeDirError && !localeDirError) { // We only proceed if there has not been any issue with the homeDir or localeDir
174
- this->_moduleStore = new ModuleStore(customHomeDir);
174
+ this->_moduleStore = new ModuleStore(this->customHomeDir);
175
175
  this->_moduleHelper = new ModuleHelper(*(this->_moduleStore));
176
- this->_repoInterface = new RepositoryInterface(this->_swordStatusReporter, *(this->_moduleHelper), customHomeDir);
177
- this->_moduleInstaller = new ModuleInstaller(*(this->_repoInterface), *(this->_moduleStore), customHomeDir);
176
+ this->_repoInterface = new RepositoryInterface(this->_swordStatusReporter, *(this->_moduleHelper), this->customHomeDir);
177
+ this->_moduleInstaller = new ModuleInstaller(*(this->_repoInterface), *(this->_moduleStore), this->customHomeDir);
178
178
  this->_napiSwordHelper = new NapiSwordHelper(*(this->_moduleHelper), *(this->_moduleStore));
179
179
  this->_textProcessor = new TextProcessor(*(this->_moduleStore), *(this->_moduleHelper));
180
180
  this->_moduleSearch = new ModuleSearch(*(this->_moduleStore), *(this->_moduleHelper), *(this->_textProcessor));
@@ -952,6 +952,10 @@ Napi::Value NodeSwordInterface::getSwordPath(const Napi::CallbackInfo& info)
952
952
  Napi::HandleScope scope(env);
953
953
 
954
954
  FileSystemHelper fsHelper;
955
+ if (this->customHomeDir != "") {
956
+ fsHelper.setCustomHomeDir(customHomeDir);
957
+ }
958
+
955
959
  Napi::String swordPath = Napi::String::New(env, fsHelper.getUserSwordDir());
956
960
  unlockApi();
957
961
  return swordPath;
@@ -112,6 +112,8 @@ private:
112
112
  SwordTranslationHelper* _swordTranslationHelper;
113
113
  SwordStatusReporter _swordStatusReporter;
114
114
  ModuleSearchWorker* _currentModuleSearchWorker;
115
+
116
+ std::string customHomeDir;
115
117
  };
116
118
 
117
119
  #endif // _NODE_SWORD_INTERFACE