tobeycarman / QLNetcdf

A QuickLook Plugin for previewing NetCDF files.
MIT License
12 stars 7 forks source link

Fails to load in Monterey #4

Open moffat opened 2 years ago

moffat commented 2 years ago

Thanks for your work on this plugin. It fails for me in Monterey:


qlmanage -p era5_2m_temperature_1990_2002.nc 
Testing Quick Look preview with files:
    era5_2m_temperature_1990_2002.nc
2022-02-12 10:42:26.298 qlmanage[45677:6593375] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x7203, name = 'com.apple.coredrag'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2022-02-12 10:42:26.313 qlmanage[45677:6593375] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8103, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.

any ideas?

tobeycarman commented 2 years ago

Hi! Shoot, I am not sure. I wrote this way back on El Cap maybe? I am currently on Catalina and although I was never able to re-compile my old Xcode project, I copied the generator files into place, and it seems to work.

If I get a chance I will try to look into it again.

moffat commented 2 years ago

hi @tobeycarman, thanks for your answer. I discovered the plugin does work if I force quicklook to use the public.item UTI:

 qlmanage -p -c public.item ../data/ERA5/era5_2m_temperature_1990_2002.nc

The output of mdls for the files shows:

kMDItemContentType                 = "dyn.ah62d4rv4ge80622"
kMDItemContentTypeTree             = (
    "public.item",
    "public.data",
    "dyn.ah62d4rv4ge80622"
)

I don't know enough about UTIs, but I guess QuickLook is getting confused by that 'dyn.xxxx' UTI?

tobeycarman commented 2 years ago

Huh, interesting. That actually rings a bell - I vaguely recall having to do something like that. Part of the problem here is that the QuickLook architecture changed from when I originally wrote this to the recent versions of macOS (I think this is partly why I was unable to compile my old project).

I am not sure what the quick fix is beyond calling qlmanage from the command line - which is not really that nice compared to the Finder integration...

A real fix would be starting fresh and making a new plugin according to the new QuickLook plugin architecture.

moffat commented 2 years ago

@tobeycarman, once I added dyn.ah62d4rv4ge80622to the Info.plist file of your project, as detailed here, the problem is solved and QuickLook works with the finder.

tobeycarman commented 2 years ago

Ah ha, now you have reminded me. I think I found the same stackexchange post and did exactly that. Indeed if I check the Info.plist file in my own ~/Library/QuickLook/QLNetcdf.qlgenerator file, I have that UTI added as well:

...
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>QLGenerator</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
                <string>public.item</string>
                <string>dyn.ah62d4rv4ge80622</string>
            </array>
        </dict>
...

And it is not present in the file on Github. The thing I was not able to figure out was the best way to re-release the project with updated release assets, since I can't seem to figure out how to re-build it using Xcode 11. Perhaps it is sufficient to simply edit the Info.plist file in the GitHub repo, and then upload my own QLNetcdf.qlgenerator file as the release asset??

I am glad you found this useful and have prodded me into thinking about it again. I have a few colleagues that would use it as well, but I had forgotten the details of how to get it working for them.

moffat commented 2 years ago

@tobeycarman, not sure how to proceed but this seems like a reasonable solution.

And yes, the plugin is super useful!

moffat commented 2 years ago

Hi @tobeycarman,

I wonder if you any further ideas about this. In the latest versions of Monterey, the plugin is back to not working. I'm using the homebrew version with all apple quarantine flags removed, and adding the right content type included.

This works:

qlmanage -p testfile.nc 

and qlmanage -m shows the dyn.ah62d4rv4ge80622 UTI correctly assigned to the QLNetcdf plugin, but the finder does not show the previews. I tried downloading the project and compiling it myself with Xcode, but the resulting plugin doesn't work at all.

tobeycarman commented 2 years ago

Shoot! Thanks so much for the feedback/testing. I don't have any ideas unfortunately as I am still on Catalina, so I haven't encountered the problem and I don't have a good way to test it. From my brief investigations the QuickLook architecture has changed in recent versions so I am not even familiar with how the templated XCode project should look/work. Very frustrating. When I eventually upgrade I will try to look into this again.

On Mon, Jul 25, 2022 at 5:04 AM Carlos Moffat @.***> wrote:

Hi @tobeycarman https://github.com/tobeycarman,

I wonder if you any further ideas about this. In the latest versions of Monterey, the plugin is back to not working. I'm using the homebrew version with all apple quarantine flags removed, and adding the right content type included.

This works:

qlmanage -p testfile.nc

and qlmanage -m shows the dyn.ah62d4rv4ge80622 UTI correctly assigned to the QLNetcdf plugin, but the finder does not show the previews. I tried downloading the project and compiling it myself with Xcode, but the resulting plugin doesn't work at all.

— Reply to this email directly, view it on GitHub https://github.com/tobeycarman/QLNetcdf/issues/4#issuecomment-1194021771, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMYT5UVTJFNHPSGCCYS7TVV2GGNANCNFSM5OHBEOLQ . You are receiving this because you were mentioned.Message ID: @.***>

moffat commented 2 years ago

Hi @tobeycarman

Thanks for the reply! I'll keep looking at this to try to find a solution.

Best.