Double click on fcd file cause an open of FidoCadJ but on a new document
gremirarunico opened this issue · 8 comments
When I double click a fcd file on finder FidoCadJ correctly load, but it doesn't load any schematic. Even if I drag and drop the schematic on the windows it won't be loaded.
I have to do File => Open and select the file to be correctly opened, or alternatevly copy paste the text contained in fcd.
Info:
FidocadJ version 0.24.8
OS MacOS 12.4 (21F79)
I confirm there is a bug on the macOS version. I will have a look at it.
Hi, I confirm the problem reported from gremirarunico.
Info:
FidoCadJ version: 0.24.8
Mac OS version: 14.1.1 (Sonoma)
Thank you! I implemented the behaviour a few years back and it worked back then. Unfortunately something broke during the Java and macOS upgrades. I'm quite busy at the moment, if someone wants to have a look, I'm not against it!
Yes, of course. I will have a look at it in a few days.
It took longer than expected, but I finally started working on this issue.
It looks that the code is (or at least should be) already there, in the ADesktopIntegration
class.
What it is missing is an appropriate description of the Info.plist
file in the macOS application bundle.
I'm currently trying to understand how a file should be associated to be opened with an application. I ran into the problem many years ago, but things seem to have changed and instead of CFBundleTypeExtensions
it seems that one has to use the UTI.
I tried to use this bundle Info.plist with some success:
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleExecutable</key>
<string>FidoCadJ</string>
<key>CFBundleIconFile</key>
<string>FidoCadJ.icns</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.fidocadj</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>fcd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>generic.icns</string>
<key>CFBundleTypeName</key>
<string>FidoCadJ file</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>net.sourceforge.fidocadj.file</string>
</array>
</dict>
</array>
<key>CFBundleName</key>
<string>FidoCadJ</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.24.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<!-- See https://developer.apple.com/app-store/categories/ for list of AppStore categories -->
<key>LSApplicationCategoryType</key>
<string>Unknown</string>
<key>CFBundleVersion</key>
<string>100</string>
<key>NSHumanReadableCopyright</key>
<string>Davide Bucci and many others</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
</dict>
</plist>
The mechanism behind CFBundleTypeExtensions
seems to work fine (VLC still uses it) and it seems to work.
No modification of the Java code is required, all is already taken into account.
I'm updating the bundle of the macOS version.
I changed a few details (and I added the file icon to the bundle).
I just updated the file in the macOS release so that the application comes with the new Info.plist.
https://github.com/DarwinNE/FidoCadJ/releases/tag/v0.24.8
If someone confirms that the problem is solved, I will close this issue.