Support calling getUploadedReports on unstarted crash reporter

This commit is contained in:
Kevin Sawicki 2016-10-05 15:39:47 -07:00
parent 56d9ce34e4
commit 43702e0f8e

View file

@ -2,6 +2,7 @@
const {spawn} = require('child_process') const {spawn} = require('child_process')
const electron = require('electron') const electron = require('electron')
const {app} = process.type === 'browser' ? electron : electron.remote
const binding = process.atomBinding('crash_reporter') const binding = process.atomBinding('crash_reporter')
class CrashReporter { class CrashReporter {
@ -12,7 +13,6 @@ class CrashReporter {
this.productName = options.productName this.productName = options.productName
let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL} = options let {autoSubmit, companyName, extra, ignoreSystemCrashHandler, submitURL} = options
const app = (process.type === 'browser' ? electron : electron.remote).app
this.tempDirectory = app.getPath('temp') this.tempDirectory = app.getPath('temp')
if (this.productName == null) { if (this.productName == null) {
this.productName = app.getName() this.productName = app.getName()
@ -66,7 +66,9 @@ class CrashReporter {
} }
getUploadedReports () { getUploadedReports () {
return binding._getUploadedReports(this.productName, this.tempDirectory) const productName = this.productName != null ? this.productName : app.getName()
const tempDirectory = this.tempDirectory != null ? this.tempDirectory : app.getPath('temp')
return binding._getUploadedReports(productName, tempDirectory)
} }
} }