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]
|
var platform = process.argv[2]
|
||||||
|
|
||||||
if (platform === '--darwin') {
|
if (platform === '--darwin') {
|
||||||
buildDarwin()
|
buildDarwin(postDarwinism)
|
||||||
} else if (platform === '--win32') {
|
} else if (platform === '--win32') {
|
||||||
buildWin32()
|
buildWin32()
|
||||||
} else if (platform === '--linux') {
|
} else if (platform === '--linux') {
|
||||||
@@ -134,6 +134,37 @@ function buildLinux (cb) {
|
|||||||
electronPackager(Object.assign({}, all, linux), done.bind(null, 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) {
|
function done (cb, err, appPath) {
|
||||||
if (err) console.error(err.message || err)
|
if (err) console.error(err.message || err)
|
||||||
else console.log('Built ' + appPath)
|
else console.log('Built ' + appPath)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
"electron-packager": "^5.0.0",
|
"electron-packager": "^5.0.0",
|
||||||
"electron-prebuilt": "0.36.10",
|
"electron-prebuilt": "0.36.10",
|
||||||
"path-exists": "^2.1.0",
|
"path-exists": "^2.1.0",
|
||||||
|
"plist": "^1.2.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"standard": "^6.0.5"
|
"standard": "^6.0.5"
|
||||||
},
|
},
|
||||||
|
|||||||
BIN
static/WebTorrentFile.icns
Normal file
BIN
static/WebTorrentFile.icns
Normal file
Binary file not shown.
BIN
static/WebTorrentFile.ico
Normal file
BIN
static/WebTorrentFile.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
BIN
static/WebTorrentFile.png
Normal file
BIN
static/WebTorrentFile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Reference in New Issue
Block a user