Skip to content

Comments

Add support for application:openFile:#26

Merged
mrmekon merged 4 commits intomrmekon:masterfrom
jorgenpt:open-file-support
Mar 20, 2021
Merged

Add support for application:openFile:#26
mrmekon merged 4 commits intomrmekon:masterfrom
jorgenpt:open-file-support

Conversation

@jorgenpt
Copy link
Contributor

@jorgenpt jorgenpt commented Mar 1, 2021

This should address GH-25, which is also needed by https://github.com/jorgenpt/bichrome which wants to pretend to be a browser and wants to register for HTML files being opened from the filesystem.

It wasn't clear from #15 what the desired path was regarding auto-formatting, so I've included a separate commit in this pull request which applies rustfmt formatting to the files touched by subsequent commits. Let me know if you want me to attempt to disable autoformatting in my IDE and re-do the changes without touching the formatting.

@mrmekon
Copy link
Owner

mrmekon commented Mar 20, 2021

Sorry for the delay! Please drop the formatting commit, and I'll merge, looks good to me.

I still prefer without rustfmt, but even if I'm convinced the reformatting should be in a dedicated PR to avoid mixing with new features. I know I'm the weirdo here, but I just dislike auto-formatters :(

This plumbs through a callback for application:openFile: -- allowing an
application to register for file types. Fixes GH-25.
This is a helper to convert `NSString` Objects into Rust `String`, so
that it's easy to parse the parameter passed to application:openFile:
Make it so that you can drag & drop a file to the Dock icon of
register_url to have it log a line and terminate.
Adding a non-macOS shim for `nsstring_to_string` will allow this crate
and the examples to build on non-macOS platforms.
@jorgenpt
Copy link
Contributor Author

Ok, I've dropped the reformatting commit!

I can understand disagreeing with the auto formatter. FWIW I think in this situation the main benefit is lowering the barrier to entry for new contributors, and helping multiple contributors stay consistent with formatting (and removing the need for complicated documentation about what the expected formatting is). I will certainly defer to your preference on formatting for your project. :)

@mrmekon
Copy link
Owner

mrmekon commented Mar 20, 2021

Thanks!

Yep, if other projects start depending on it and outside contributions become common, I'm certainly open to reformatting. At the moment, this is just a personal dependency for a personal project that a few other people have poked at a couple of times, so changing it all around burdens me a bit more than it helps others. Maybe that will change :)

@mrmekon mrmekon merged commit 7db3c18 into mrmekon:master Mar 20, 2021
jorgenpt added a commit to jorgenpt/bichrome that referenced this pull request Mar 20, 2021
Now that mrmekon/fruitbasket#26 has been merged,
switch the fruitbasket dependency to mrmekon/fruitbasket's mainline,
rather than using our own branch.
@jorgenpt jorgenpt deleted the open-file-support branch March 20, 2021 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants