[英]Open files with mono gtk# on Mac OSX
我使用mono和gtk#开发了适用于mac的应用程序。
问题是默认的文件处理程序。 我使用此Info.plist(片段)注册我的应用程序
...
<array>
<dict>
<key>CFBundleTypeName</key>
<string>My Filetype</string>
<key>CFBundleTypeIconFile</key>
<string>file.icns</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>ext</string>
<string>EXT</string>
</array>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
....
它正确注册(图标匹配,打开我的应用程序),但是每当我打开文件时,都会出现以下消息:
The document "test.ext" could not be opened. mono cannot open files of this type.
那么我该如何运作呢?
我自己发现的:
将https://github.com/mono/monodevelop/tree/master/main/src/addins/MacPlatform/MacInterop包含到您的项目中。
使用此代码
ApplicationEvents.OpenDocuments+= delegate (object sender, ApplicationDocumentEventArgs e) { if (e.Documents != null && e.Documents.Count > 0) { // e.Documents holds the files } e.Handled = true; };
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.