mirror of
https://github.com/Koenkk/zigbee-OTA.git
synced 2026-09-01 18:46:04 +00:00
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:
+9
-1
@@ -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)})`);
|
||||
|
||||
Reference in New Issue
Block a user