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
|
srcDirectory: srcDirectory
|
||||||
extensionInfoMap[manifest.name]
|
extensionInfoMap[manifest.name]
|
||||||
|
|
||||||
# Load persistented extensions.
|
# The loaded extensions cache and its persistent path.
|
||||||
loadedExtensionsPath = path.join app.getDataPath(), 'DevTools Extensions'
|
loadedExtensions = null
|
||||||
|
loadedExtensionsPath = null
|
||||||
try
|
|
||||||
loadedExtensions = JSON.parse fs.readFileSync(loadedExtensionsPath)
|
|
||||||
loadedExtensions = [] unless Array.isArray loadedExtensions
|
|
||||||
# Preheat the extensionInfo cache.
|
|
||||||
getExtensionInfoFromPath srcDirectory for srcDirectory in loadedExtensions
|
|
||||||
catch e
|
|
||||||
|
|
||||||
# Persistent loaded extensions.
|
# Persistent loaded extensions.
|
||||||
app.on 'will-quit', ->
|
app.on 'will-quit', ->
|
||||||
|
@ -59,6 +53,16 @@ app.once 'ready', ->
|
||||||
protocol = require 'protocol'
|
protocol = require 'protocol'
|
||||||
BrowserWindow = require 'browser-window'
|
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.
|
# The chrome-extension: can map a extension URL request to real file path.
|
||||||
protocol.registerProtocol 'chrome-extension', (request) ->
|
protocol.registerProtocol 'chrome-extension', (request) ->
|
||||||
parsed = url.parse request.url
|
parsed = url.parse request.url
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue