enable os x file drop, add osx torrent file icon
- fixes #131 - partially addresses #77 for osx (now handles .torrent files)
This commit is contained in:
@@ -112,7 +112,7 @@ var linux = {
|
||||
var platform = process.argv[2]
|
||||
|
||||
if (platform === '--darwin') {
|
||||
buildDarwin()
|
||||
buildDarwin(postDarwinism)
|
||||
} else if (platform === '--win32') {
|
||||
buildWin32()
|
||||
} else if (platform === '--linux') {
|
||||
@@ -134,6 +134,37 @@ function buildLinux (cb) {
|
||||
electronPackager(Object.assign({}, all, linux), done.bind(null, cb))
|
||||
}
|
||||
|
||||
function postDarwinism () {
|
||||
var plist = require('plist')
|
||||
var contentsPath = path.join.apply(null, [
|
||||
__dirname,
|
||||
'..',
|
||||
'dist',
|
||||
`${config.APP_NAME}-darwin-x64`,
|
||||
`${config.APP_NAME}.app`,
|
||||
'Contents'
|
||||
])
|
||||
var resourcesPath = path.join(contentsPath, 'Resources')
|
||||
var infoPlistPath = path.join(contentsPath, 'Info.plist')
|
||||
var webTorrentFileIconPath = path.join.apply(null, [
|
||||
__dirname,
|
||||
'..',
|
||||
'static',
|
||||
'WebTorrentFile.icns'
|
||||
])
|
||||
var infoPlist = plist.parse(fs.readFileSync(infoPlistPath).toString())
|
||||
|
||||
infoPlist['CFBundleDocumentTypes'] = [{
|
||||
CFBundleTypeExtensions: [ 'torrent' ],
|
||||
CFBundleTypeName: 'BitTorrent Document',
|
||||
CFBundleTypeRole: 'Editor',
|
||||
CFBundleTypeIconFile: 'WebTorrentFile.icns'
|
||||
}]
|
||||
|
||||
fs.writeFileSync(infoPlistPath, plist.build(infoPlist))
|
||||
cp.execSync(`cp ${webTorrentFileIconPath} ${resourcesPath}`)
|
||||
}
|
||||
|
||||
function done (cb, err, appPath) {
|
||||
if (err) console.error(err.message || err)
|
||||
else console.log('Built ' + appPath)
|
||||
|
||||
Reference in New Issue
Block a user