WEB/Electron

[Electron] 탐색기 여는 방법

S0PH1A 2019. 4. 8. 15:29
반응형

[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 관련 파라메터

getPath()

 

 


[참고] https://github.com/electron/electron/blob/master/docs/api/shell.md

[참고] https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname

반응형