8000 [Bug]: Linux `defaultPath` does not work on file dialogs for opening · Issue #43310 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
8000 Skip to content
[Bug]: Linux defaultPath does not work on file dialogs for opening #43310
Closed
@bpasero

Description

@bpasero

Preflight Checklist

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:

Image

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)
  }
})

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0