首页 > 解决方案 > 在 Windows 上将 defaultPath 设置为这台电脑,可能吗?

问题描述

我尝试将defaultPathto设置This PC为路径,但它不想工作。无奈之下,我也尝试过\and .,这两种方法也都不起作用。我试过从文件资源管理器复制地址,但它只是复制文本“这台电脑”。我尝试This PC在文件资源管理器中右键单击以查看其属性,但它会将我发送到Control Panel > System and Security > System.

我想知道是否可以在 Windows 上将defaultPathElectron 的设置为这台 PC?dialog.showOpenDialog

如果没有,我会将其设置为c:\\,但我宁愿将默认路径设置为所有驱动器的概览。

dialog.showOpenDialog(
  remote.getCurrentWindow(),
  {
    title: 'Select Archives to Analyze',
    buttonLabel: 'Select Archives',
    defaultPath: 'This PC',
    properties: [ 'openDirectory', 'multiSelections', 'showHiddenFiles' ]
  }
)
.then(res => !res.canceled && saveDirs(res.filePaths))
.catch(err => {
  console.log(err)
})

标签: javascriptnode.jswindowsdialogelectron

解决方案


推荐阅读