单击电子应用程序中的文件时显示系统“打开方式”对话框

mdt*_*mdt 5 open-with electron

在我的 Electron 应用程序中,我存储指向本地文件路径的链接。现在我希望用户能够使用操作系统配置的任何应用程序(或通常的“打开方式”对话框)打开此类链接。

这可能吗?

谢谢

mdt*_*mdt 1

在这里找到了可能的解决方案列表:

\n

/sf/answers/2339793361/

\n

其中,在我看来最相关的是 shell 模块插件:

\n

https:// Electron.atom.io/docs/api/shell/

\n

其中提供了以下API:

\n
\n
shell.openItem(fullPath)\n
Run Code Online (Sandbox Code Playgroud)\n

在桌面\xe2\x80\x99s默认方式下打开给定文件。

\n

返回 Boolean - 项目是否已成功打开。

\n
\n