feat: promisify dialog.showOpenDialog() (#16973)

* feat: promisify dialog.showOpenDialog()

* address feedback from review

* address feedback from review
This commit is contained in:
Shelley Vohr 2019-03-05 05:54:48 -08:00 committed by GitHub
parent 7936237677
commit e05985145b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 235 additions and 154 deletions

View file

@ -86,9 +86,9 @@ ipcMainUtils.handle('ELECTRON_INSPECTOR_SELECT_FILE', function (event) {
return new Promise((resolve, reject) => {
assertChromeDevTools(event.sender, 'window.UI.createFileSelectorElement()')
dialog.showOpenDialog({}, function (files) {
if (files) {
const path = files[0]
dialog.showOpenDialog({}, function (result) {
if (!result.canceled) {
const path = result.filePaths[0]
fs.readFile(path, (error, data) => {
if (error) {
reject(error)