Merge remote-tracking branch 'origin/dont-write-empty-dev-tools-extensions-file'
This commit is contained in:
commit
7ca09de386
3 changed files with 30 additions and 6 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
|
||||
}
|
||||
fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions));
|
||||
} else {
|
||||
fs.unlinkSync(loadedExtensionsPath);
|
||||
}
|
||||
return fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions));
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
|
@ -70,7 +74,7 @@ app.once('ready', function() {
|
|||
var BrowserWindow, chromeExtensionHandler, i, init, len, protocol, srcDirectory;
|
||||
protocol = electron.protocol, BrowserWindow = electron.BrowserWindow;
|
||||
|
||||
// Load persistented extensions.
|
||||
// Load persisted extensions.
|
||||
loadedExtensionsPath = path.join(app.getPath('userData'), 'DevTools Extensions');
|
||||
try {
|
||||
loadedExtensions = JSON.parse(fs.readFileSync(loadedExtensionsPath));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue