add icon for linux desktop file

This commit is contained in:
grunjol
2016-03-20 12:47:55 -03:00
parent f21d869bf7
commit 6dacc445e8

View File

@@ -7,6 +7,7 @@ module.exports = function () {
}
if (process.platform === 'linux') {
installDesktopFile()
installDesktopIcon()
}
}
@@ -27,6 +28,19 @@ function installDesktopFile () {
fs.writeFileSync(desktopFilePath, desktopFile)
}
function installDesktopIcon () {
var config = require('../config')
var fs = require('fs')
var path = require('path')
var os = require('os')
var iconStaticPath = path.join(config.STATIC_PATH, 'WebTorrent.png')
var iconFile = fs.readFileSync(iconStaticPath)
var iconFilePath = path.join(os.homedir(), '.local', 'share', 'icons', 'webtorrent.png')
fs.writeFileSync(iconFilePath, iconFile)
}
/**
* To add a protocol handler on Windows, the following keys must be added to the Windows
* registry: