Delete extensions file when there are no loaded extensions
This commit is contained in:
parent
5714ae0b73
commit
6252511b7f
1 changed files with 9 additions and 5 deletions
|
@ -54,12 +54,16 @@ app.on('will-quit', function() {
|
|||
loadedExtensions = Object.keys(extensionInfoMap).map(function(key) {
|
||||
return extensionInfoMap[key].srcDirectory;
|
||||
});
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(loadedExtensionsPath));
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
if (loadedExtensions.length > 0) {
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(loadedExtensionsPath));
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
return fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions));
|
||||
} else {
|
||||
fs.unlinkSync(loadedExtensionsPath);
|
||||
}
|
||||
return fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions));
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue