Closed
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
30.x
What operating system(s) are you using?
Ubuntu
Operating System Version
Ubuntu 22.04
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Expected Behavior
A defaultPath
passed to a open dialog should open in that folder.
Actual Behavior
Dialogs always open here:
Testcase Gist URL
No response
Additional Information
This issue is specific both to the open file dialog when using the dialog portal implementation.
Repro:
const { app, BrowserWindow, dialog } = require('electron/main')
app.whenReady().then(async () => {
const mainWindow = new BrowserWindow({ height: 600, width: 600 })
// Show an "Open File" dialog and attempt to open
// the chosen file in our window.
try {
const { filePaths, canceled } = await dialog.showOpenDialog(mainWindow, {
properties: ['openFile'],
defaultPath: '/home/parallels/GitDevelopment/vscode'
})
if (canceled) {
console.log('Dialog was canceled')
} else {
const file = filePaths[0]
mainWindow.loadFile(file)
}
} catch (err) {
console.log(err)
}
})