Shell
Shell
是一系列執行桌面相關工作的 API。
概要
// Open URL with default browser. nw.Shell.openExternal('https://github.com/nwjs/nw.js'); // Open a text file with default text editor. nw.Shell.openItem('test.txt'); // Show a file in parent folder with file manager. nw.Shell.showItemInFolder('test.txt');
Shell.openExternal(uri)
uri
{字串}
以系統預設方式開啟的 URL。
以桌面的預設方式開啟指定的外部 URI。例如,預設郵件使用者代理程式中的 mailto: URL。
Shell.openItem(file_path)
file_path
{String}
本機檔案路徑
以桌面預設方式開啟指定的 file_path
。
Shell.showItemInFolder(file_path)
file_path
{String}
本機檔案路徑
在檔案管理員中,以父資料夾顯示指定的 file_path
。如果可能,請選取檔案。