Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop: Tell macOS that Ruffle can open SWF files #10880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Korne127
Copy link
Contributor

Currently, macOS doesn't recognise that Ruffle is capable of opening SWF files. Therefore, Ruffle isn't included in the list of programs to open an SWF file with, and you need to manually change the settings to open SWFs with Ruffle.

This Pull Request changes that; it includes the necessary metadata in the Info.plist file to tell macOS that Ruffle can open SWF files and should be the default program to open an SWF file with.

Additionally, this should cause SWF file icons to be generated during the build process. This means that SWF files will have the Ruffle logo on their file icon.

The CFBundleDocumentTypes information has been added to the Info.plist
on macOS.
This part of the Info.plist tells the operating system which file
extensions a program can open.
The added information states that Ruffle can open SWF files and should
be the default program to open an SWF file with.

Additionally, this should cause CFBundleTypeIconFiles to be generated
during the build process.
This means that SWF files will have the Ruffle logo on their file icon.
@kmeisthax
Copy link
Member

I actually played around with doing this a while back, and even made a custom file icon for SWFs. I don't remember the branch name I pushed for it, though, otherwise I'd offer you those icons to include in your PR.

I didn't actually PR that, however, because when you launched SWFs by double-clicking Ruffle wouldn't actually open them. The reason why is weird. On Windows or Linux, when you associate a file type to a program, the shell invokes your application with the path to the file as the command-line argument. Ruffle supports this just fine. On macOS, the application does NOT get a command-line argument, it's launched normally, and then the ApplicationDelegate gets a message (from, oddly enough, AppleScript events) to open the given file.

Turns out, the window system abstraction layer we use, winit, does not actually support the open files message. So we can't handle the file association correctly. See rust-windowing/winit#1751

@Korne127
Copy link
Contributor Author

Thank you for the reply!

And it's interesting that you've already working on this. I mean, custom file icons would be awesome of course. Have you pushed that upstream or just locally? It might be possible to locate the branch with a script (searching for changes in the Info.plist or assets folder).

But yeah, I've actually noticed the bug with the double-clicks as well yesterday. I've spent a bit of time testing around with opening SWF files on macOS and the problems it currently has and planned to open #10889 and #10890 (and already wrote #10890), but it was so late that I wanted to look over the texts again on the next day before posting.
Thank you for explaining the issue though! Winit seems to have a Pull Request to fix it (rust-windowing/winit#1759) and it looks like the consensus there was to implement it. But for some reason, it has been unchanged for two years now and wasn't merged; I wrote a comment there, asking about the state.

@danielhjacobs danielhjacobs added A-desktop Area: Desktop Application T-feature Type: New Feature (that Flash doesn't have) labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-desktop Area: Desktop Application T-feature Type: New Feature (that Flash doesn't have)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants