javascript - 在 Windows 上将 defaultPath 设置为这台电脑,可能吗?
问题描述
我尝试将defaultPath
to设置This PC
为路径,但它不想工作。无奈之下,我也尝试过\
and .
,这两种方法也都不起作用。我试过从文件资源管理器复制地址,但它只是复制文本“这台电脑”。我尝试This PC
在文件资源管理器中右键单击以查看其属性,但它会将我发送到Control Panel > System and Security > System
.
我想知道是否可以在 Windows 上将defaultPath
Electron 的设置为这台 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)
})
解决方案
推荐阅读
- asp.net-core - 如何在服务器的 Asp.Net Core Web API 中处理自定义异常
- python - 查找图像中检测到指定颜色的坐标
- react-native - 错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
- python - Snowboy 启动指令检测和 Raspberry Pi:IOError:[Errno -9997] 无效采样率
- assembly - 我应该在固件中填写多少异常向量?
- javascript - Puppeteer TimeoutError:超过 30000 毫秒的导航超时
- dompdf - Laravel 6 barryvdh / laravel-dompdf 渲染问题
- javascript - 从 webapp 深度链接到 Google Pay 等 UPI 应用
- django - 仅当值存在于另一个表中时,我如何返回 Django 查询集?
- java - 可以在 webDriver 的不同端口使用当前会话吗?