Associate .torrent files to WebTorrent Desktop (OS X) (#553)
Before this change, .torrent files would only be associated to WebTorrent Desktop if another torrent client (like Transmission) was installed on the system. That's because one of the user's apps needs to define "UTExportedTypeDeclarations". On a fresh machine, without Transmission, WebTorrent Desktop now associates .torrent files correctly. So it will appear in the "Open With..." menu and the webtorrent .torrent icon will be used for .torrent files. Closes #542.
This commit is contained in:
parent
870dd893fc
commit
8cf544d54f
1 changed files with 19 additions and 2 deletions
|
|
@ -182,8 +182,6 @@ function buildDarwin (cb) {
|
|||
var infoPlistPath = path.join(contentsPath, 'Info.plist')
|
||||
var infoPlist = plist.parse(fs.readFileSync(infoPlistPath, 'utf8'))
|
||||
|
||||
// TODO: Use new `extend-info` and `extra-resource` opts to electron-packager,
|
||||
// available as of v6.
|
||||
infoPlist.CFBundleDocumentTypes = [
|
||||
{
|
||||
CFBundleTypeExtensions: [ 'torrent' ],
|
||||
|
|
@ -211,6 +209,25 @@ function buildDarwin (cb) {
|
|||
}
|
||||
]
|
||||
|
||||
infoPlist.UTExportedTypeDeclarations = [
|
||||
{
|
||||
UTTypeConformsTo: [
|
||||
'public.data',
|
||||
'public.item',
|
||||
'com.bittorrent.torrent'
|
||||
],
|
||||
UTTypeDescription: 'BitTorrent Document',
|
||||
UTTypeIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
||||
UTTypeIdentifier: 'org.bittorrent.torrent',
|
||||
UTTypeReferenceURL: 'http://www.bittorrent.org/beps/bep_0000.html',
|
||||
UTTypeTagSpecification: {
|
||||
'com.apple.ostype': 'TORR',
|
||||
'public.filename-extension': [ 'torrent' ],
|
||||
'public.mime-type': 'application/x-bittorrent'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
fs.writeFileSync(infoPlistPath, plist.build(infoPlist))
|
||||
|
||||
// Copy torrent file icon into app bundle
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue