Skip to content

Commit f660af1

Browse files
committed
feat(file-assoc): 新增 macOS .torrent 文件关联
通过 Launch Services (LSSetDefaultRoleHandlerForContentType) 实现 macOS 端关联,并在 Info.plist 声明 org.bittorrent.torrent UTI 与文档类型。
1 parent f7892fb commit f660af1

2 files changed

Lines changed: 519 additions & 276 deletions

File tree

macos/Runner/Info.plist

Lines changed: 79 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,79 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3-
<plist version="1.0">
4-
<dict>
5-
<key>CFBundleDevelopmentRegion</key>
6-
<string>$(DEVELOPMENT_LANGUAGE)</string>
7-
<key>CFBundleExecutable</key>
8-
<string>$(EXECUTABLE_NAME)</string>
9-
<key>CFBundleIconFile</key>
10-
<string></string>
11-
<key>CFBundleIdentifier</key>
12-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13-
<key>CFBundleInfoDictionaryVersion</key>
14-
<string>6.0</string>
15-
<key>CFBundleName</key>
16-
<string>$(PRODUCT_NAME)</string>
17-
<key>CFBundlePackageType</key>
18-
<string>APPL</string>
19-
<key>CFBundleShortVersionString</key>
20-
<string>$(FLUTTER_BUILD_NAME)</string>
21-
<key>CFBundleVersion</key>
22-
<string>$(FLUTTER_BUILD_NUMBER)</string>
23-
<key>LSMinimumSystemVersion</key>
24-
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
25-
<key>NSHumanReadableCopyright</key>
26-
<string>$(PRODUCT_COPYRIGHT)</string>
27-
<key>NSUserNotificationUsageDescription</key>
28-
<string>FluxDown uses notifications to alert you when downloads complete.</string>
29-
<key>CFBundleDisplayName</key>
30-
<string>FluxDown</string>
31-
<key>NSMainNibFile</key>
32-
<string>MainMenu</string>
33-
<key>NSPrincipalClass</key>
34-
<string>NSApplication</string>
35-
</dict>
36-
</plist>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIconFile</key>
10+
<string></string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>$(FLUTTER_BUILD_NAME)</string>
21+
<key>CFBundleVersion</key>
22+
<string>$(FLUTTER_BUILD_NUMBER)</string>
23+
<key>LSMinimumSystemVersion</key>
24+
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
25+
<key>NSHumanReadableCopyright</key>
26+
<string>$(PRODUCT_COPYRIGHT)</string>
27+
<key>NSUserNotificationUsageDescription</key>
28+
<string>FluxDown uses notifications to alert you when downloads complete.</string>
29+
<key>CFBundleDisplayName</key>
30+
<string>FluxDown</string>
31+
<key>NSMainNibFile</key>
32+
<string>MainMenu</string>
33+
<key>NSPrincipalClass</key>
34+
<string>NSApplication</string>
35+
<key>CFBundleDocumentTypes</key>
36+
<array>
37+
<dict>
38+
<key>CFBundleTypeName</key>
39+
<string>BitTorrent Document</string>
40+
<key>CFBundleTypeExtensions</key>
41+
<array>
42+
<string>torrent</string>
43+
</array>
44+
<key>CFBundleTypeRole</key>
45+
<string>Viewer</string>
46+
<key>LSHandlerRank</key>
47+
<string>Owner</string>
48+
<key>LSItemContentTypes</key>
49+
<array>
50+
<string>org.bittorrent.torrent</string>
51+
</array>
52+
</dict>
53+
</array>
54+
<key>UTImportedTypeDeclarations</key>
55+
<array>
56+
<dict>
57+
<key>UTTypeIdentifier</key>
58+
<string>org.bittorrent.torrent</string>
59+
<key>UTTypeDescription</key>
60+
<string>BitTorrent Document</string>
61+
<key>UTTypeConformsTo</key>
62+
<array>
63+
<string>public.data</string>
64+
</array>
65+
<key>UTTypeTagSpecification</key>
66+
<dict>
67+
<key>public.filename-extension</key>
68+
<array>
69+
<string>torrent</string>
70+
</array>
71+
<key>public.mime-type</key>
72+
<array>
73+
<string>application/x-bittorrent</string>
74+
</array>
75+
</dict>
76+
</dict>
77+
</array>
78+
</dict>
79+
</plist>

0 commit comments

Comments
 (0)