@iobroker/js-controller-common 4.0.16-alpha.2-20220302-c5d9b244 → 4.0.18

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.
@@ -242,20 +242,32 @@ function getAppName() {
242
242
  function rmdirRecursiveSync(path) {
243
243
  if (fs.existsSync(path)) {
244
244
  fs.readdirSync(path).forEach(file => {
245
- const curPath = path + '/' + file;
246
- if (fs.statSync(curPath).isDirectory()) {
247
- // recurse
248
- rmdirRecursiveSync(curPath);
249
- } else {
250
- // delete file
251
- fs.unlinkSync(curPath);
245
+ const curPath = `${path}/${file}`;
246
+ try {
247
+ if (fs.statSync(curPath).isDirectory()) {
248
+ // recurse
249
+ rmdirRecursiveSync(curPath);
250
+ } else {
251
+ // delete file
252
+ fs.unlinkSync(curPath);
253
+ }
254
+ } catch (e) {
255
+ if (e.code !== 'ENOENT') {
256
+ console.log(`Cannot delete file ${path}: ${e.message}`);
257
+ } else {
258
+ throw e;
259
+ }
252
260
  }
253
261
  });
254
262
  // delete (hopefully) empty folder
255
263
  try {
256
264
  fs.rmdirSync(path);
257
265
  } catch (e) {
258
- console.log('Cannot delete directory ' + path + ': ' + e.message);
266
+ if (e.code !== 'ENOENT') {
267
+ console.log(`Cannot delete directory ${path}: ${e.message}`);
268
+ } else {
269
+ throw e;
270
+ }
259
271
  }
260
272
  }
261
273
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/js-controller-common",
3
- "version": "4.0.16-alpha.2-20220302-c5d9b244",
3
+ "version": "4.0.18",
4
4
  "engines": {
5
5
  "node": ">=12.0.0"
6
6
  },
@@ -47,5 +47,5 @@
47
47
  "lib/",
48
48
  "index.js"
49
49
  ],
50
- "gitHead": "ffb137f6b5909e784a5a41f0a96028645da5f092"
50
+ "gitHead": "ff1f5de7065853138ffc0ece3dc941c7a59fec6c"
51
51
  }