Move unrelated code out of menu.js and ipc.js

This commit is contained in:
Feross Aboukhadijeh
2016-05-29 01:09:42 -07:00
parent d4efebd694
commit 62cb304971
16 changed files with 469 additions and 403 deletions

32
main/shell.js Normal file
View File

@@ -0,0 +1,32 @@
module.exports = {
openExternal,
openItem,
showItemInFolder
}
var electron = require('electron')
var log = require('./log')
/**
* Open the given external protocol URL in the desktops default manner.
*/
function openExternal (url) {
log(`openExternal: ${url}`)
electron.shell.openExternal(url)
}
/**
* Open the given file in the desktops default manner.
*/
function openItem (path) {
log(`openItem: ${path}`)
electron.shell.openItem(path)
}
/**
* Show the given file in a file manager. If possible, select the file.
*/
function showItemInFolder (path) {
log(`showItemInFolder: ${path}`)
electron.shell.showItemInFolder(path)
}