@iobroker/js-controller-common 4.0.16-alpha.2-20220302-c5d9b244 → 4.0.16
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/lib/common/tools.js +20 -8
- package/package.json +2 -2
package/lib/common/tools.js
CHANGED
|
@@ -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
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
|
|
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
|
|
3
|
+
"version": "4.0.16",
|
|
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": "
|
|
50
|
+
"gitHead": "7d08edcb1e8addc862ddacc15995cc952c06c53b"
|
|
51
51
|
}
|