Call app.getDataPath after app is ready
It is possible for users to override the data path.
This commit is contained in:
parent
45c26e0e5a
commit
2d1afbf51b
1 changed files with 13 additions and 9 deletions
|
@ -34,15 +34,9 @@ getExtensionInfoFromPath = (srcDirectory) ->
|
|||
srcDirectory: srcDirectory
|
||||
extensionInfoMap[manifest.name]
|
||||
|
||||
# Load persistented extensions.
|
||||
loadedExtensionsPath = path.join app.getDataPath(), 'DevTools Extensions'
|
||||
|
||||
try
|
||||
loadedExtensions = JSON.parse fs.readFileSync(loadedExtensionsPath)
|
||||
loadedExtensions = [] unless Array.isArray loadedExtensions
|
||||
# Preheat the extensionInfo cache.
|
||||
getExtensionInfoFromPath srcDirectory for srcDirectory in loadedExtensions
|
||||
catch e
|
||||
# The loaded extensions cache and its persistent path.
|
||||
loadedExtensions = null
|
||||
loadedExtensionsPath = null
|
||||
|
||||
# Persistent loaded extensions.
|
||||
app.on 'will-quit', ->
|
||||
|
@ -59,6 +53,16 @@ app.once 'ready', ->
|
|||
protocol = require 'protocol'
|
||||
BrowserWindow = require 'browser-window'
|
||||
|
||||
# Load persistented extensions.
|
||||
loadedExtensionsPath = path.join app.getDataPath(), 'DevTools Extensions'
|
||||
|
||||
try
|
||||
loadedExtensions = JSON.parse fs.readFileSync(loadedExtensionsPath)
|
||||
loadedExtensions = [] unless Array.isArray loadedExtensions
|
||||
# Preheat the extensionInfo cache.
|
||||
getExtensionInfoFromPath srcDirectory for srcDirectory in loadedExtensions
|
||||
catch e
|
||||
|
||||
# The chrome-extension: can map a extension URL request to real file path.
|
||||
protocol.registerProtocol 'chrome-extension', (request) ->
|
||||
parsed = url.parse request.url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue