Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
fix: update to electron changed showOpenDialog api
Browse files Browse the repository at this point in the history
  • Loading branch information
okdistribute committed Feb 17, 2020
1 parent f3aceb9 commit 834b23a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ export const copyLink = link => {
export const closeShareDat = () => ({ type: 'DIALOGS_LINK_CLOSE' })

export const createDat = () => dispatch => {
const files = showOpenDialog({
showOpenDialog({
properties: ['openDirectory']
}).then(({ filePaths, cancelled }) => {
if (cancelled) return
if (!filePaths) {
console.error('Did not get files from the open dialog, closing')
return
}
const path = filePaths[0]
addDat({ path })(dispatch)
}).catch((err) => {
console.error(err)
})
if (!files || !files.length) return
const path = files[0]
addDat({ path })(dispatch)
}
export const requestDownload = key => ({
type: 'REQUEST_DOWNLOAD',
Expand Down

0 comments on commit 834b23a

Please sign in to comment.