Xiaomi/Aqara OTA-firmware (#38)

* fix for relative path (for windows). no throw error when no file.

Co-authored-by: Киров Илья <kirov@bars.group>
This commit is contained in:
Ilya Kirov
2021-04-06 17:51:20 +02:00
committed by GitHub
co-authored by Киров Илья
parent 41b4f685ac
commit c97b3989a2
41 changed files with 399 additions and 1 deletions
+9 -1
View File
@@ -20,6 +20,7 @@ const manufacturerNameLookup = {
4678: 'Danfoss',
4687: 'Gledopto',
4919: 'Datek',
4447: 'Xiaomi',
};
const main = async () => {
@@ -99,7 +100,14 @@ const main = async () => {
indexJSON[index] = entry;
if (entry.path && entry.path !== destination) {
fs.unlinkSync(entry.path);
try {
fs.unlinkSync(path.resolve(entry.path));
} catch (err) {
if (err && err.code != 'ENOENT') {
console.error("Error in call to fs.unlink", err);
throw err;
}
}
}
} else {
console.log(`Added new entry (${JSON.stringify(entry)})`);