Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
catch errors in getPepperFlashPath
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Dec 14, 2016
1 parent 6f14654 commit 9756fe8
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions js/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,27 @@ const handleFlashInstallUrl = (details, isPrivate) => {
}

module.exports.checkFlashInstalled = (cb) => {
const pepperFlashSystemPluginPath = getPepperFlashPath()
const pepperFlashManifestPath = path.resolve(pepperFlashSystemPluginPath, '..', 'manifest.json')
fs.readFile(pepperFlashManifestPath, (err, data) => {
try {
if (err || !data) {
flashInstalled = false
} else {
const manifest = JSON.parse(data)
app.commandLine.appendSwitch('ppapi-flash-path', pepperFlashSystemPluginPath)
app.commandLine.appendSwitch('ppapi-flash-version', manifest.version)
flashInstalled = true
try {
const pepperFlashSystemPluginPath = getPepperFlashPath()
const pepperFlashManifestPath = path.resolve(pepperFlashSystemPluginPath, '..', 'manifest.json')
fs.readFile(pepperFlashManifestPath, (err, data) => {
try {
if (err || !data) {
flashInstalled = false
} else {
const manifest = JSON.parse(data)
app.commandLine.appendSwitch('ppapi-flash-path', pepperFlashSystemPluginPath)
app.commandLine.appendSwitch('ppapi-flash-version', manifest.version)
flashInstalled = true
}
} finally {
appActions.changeSetting(settings.FLASH_INSTALLED, flashInstalled)
cb && cb(flashInstalled)
}
} finally {
appActions.changeSetting(settings.FLASH_INSTALLED, flashInstalled)
cb && cb(flashInstalled)
}
})
})
} catch (e) {
cb && cb(flashInstalled)
}
}

module.exports.init = () => {
Expand Down

0 comments on commit 9756fe8

Please sign in to comment.