반응형
[Electron] 탐색기 여는 방법
shell을 이용해서 탐색기를 열 수 있다.
const electron = require('electron');
const { shell } = electron;
const app = electron.app || electron.remote.app;
const appDir = app.getPath('userData'); // AppData 폴더
// 탐색기 열기
function openDir(url) {
shell.showItemInFolder(appDir);
}
shell을 이용하면,
탐색기 열기 뿐만 아니라,
파일 열기 shell.openItem(fullPath),
선택한 아이템을 휴지통으로 보내는 기능 shell.moveItemToTrash(fullPath) 등이 존재한다.
* getPath 관련 파라메터

[참고] https://github.com/electron/electron/blob/master/docs/api/shell.md
[참고] https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname
반응형
'WEB > Electron' 카테고리의 다른 글
| [Electron] img 태그 src="file://~" 경로에 존재하는 파일이 로드되지 않는 경우 해결 방법 (0) | 2019.04.24 |
|---|---|
| [Electron] HTML에 다른 HTML 파일을 include하여 사용하기 (0) | 2019.04.16 |
| [Electron] database 연결하기 (0) | 2019.04.06 |
| [Electron] Global Variable 사용 방법 (0) | 2019.04.05 |
| [Electron] contextmenu 만드는 방법 (0) | 2019.04.04 |