Last active
June 14, 2023 17:49
-
-
Save jamiebuilds/4731be0aa643774a71e4543a572f753f to your computer and use it in GitHub Desktop.
showSaveDialog without filters bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let { app, dialog } = require('electron') | |
app.whenReady().then(async () => { | |
// case 1: without filters (BUG) | |
{ | |
let { canceled, filePath } = await dialog.showSaveDialog({ | |
defaultPath: "change-me.txt", | |
}) | |
if (canceled) return | |
await dialog.showMessageBox({ | |
message: `Selected file path (without filters): ${filePath}` | |
}) | |
} | |
// case 2: with filters (OK) | |
{ | |
let { canceled, filePath } = await dialog.showSaveDialog({ | |
defaultPath: "change-me.txt", | |
filters: [{ name: "Text Files", extensions: ["txt"] }] | |
}) | |
if (canceled) return | |
await dialog.showMessageBox({ | |
message: `Selected file path (with filters): ${filePath}` | |
}) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "dangerous-hill-rain-7reyd", | |
"productName": "dangerous-hill-rain-7reyd", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "Jamie", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "25.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
electron/electron#38794