diff --git a/bin/package.js b/bin/package.js index 2fa97387..3dede2f1 100755 --- a/bin/package.js +++ b/bin/package.js @@ -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