42 lines
877 B
JavaScript
42 lines
877 B
JavaScript
module.exports = {
|
||
openExternal,
|
||
openItem,
|
||
showItemInFolder,
|
||
moveItemToTrash
|
||
}
|
||
|
||
var electron = require('electron')
|
||
var log = require('./log')
|
||
|
||
/**
|
||
* Open the given external protocol URL in the desktop’s default manner.
|
||
*/
|
||
function openExternal (url) {
|
||
log(`openExternal: ${url}`)
|
||
electron.shell.openExternal(url)
|
||
}
|
||
|
||
/**
|
||
* Open the given file in the desktop’s 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)
|
||
}
|
||
|
||
/**
|
||
* Move the given file to trash and returns a boolean status for the operation.
|
||
*/
|
||
function moveItemToTrash (path) {
|
||
log(`moveItemToTrash: ${path}`)
|
||
electron.shell.moveItemToTrash(path)
|
||
}
|