Xiaomi/Aqara OTA-firmware (#28)

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

* Xiaomi/Aqara ota-firmware
This commit is contained in:
Ilya Kirov
2021-03-11 20:01:11 +01:00
committed by GitHub
parent eee9d83be4
commit 293b99e011
41 changed files with 118 additions and 2 deletions
+9 -1
View File
@@ -19,6 +19,7 @@ const manufacturerNameLookup = {
4151: 'Eurotronic',
4678: 'Danfoss',
4687: 'Gledopto',
4447: 'Xiaomi',
};
const main = async () => {
@@ -98,7 +99,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)})`);