-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfilePath.js
More file actions
29 lines (26 loc) · 714 Bytes
/
Copy pathfilePath.js
File metadata and controls
29 lines (26 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// File Manager functions.
const { dialog } = require('electron')
async function handleFileOpen (window, options) {
const { canceled, filePaths } = await dialog.showOpenDialog(window, options)
// If the user cancels the operation then just cancel.
if (canceled) {
return ''
} else {
// Otherwise return the filepath.
return filePaths[0]
}
}
async function handleFileSave (window, options) {
const { canceled, filePath } = await dialog.showSaveDialog(window, options)
// If the user cancels the operation then just cancel.
if (canceled) {
return ''
} else {
// Otherwise return the filepath.
return filePath
}
}
module.exports = {
handleFileOpen,
handleFileSave
}