-
Notifications
You must be signed in to change notification settings - Fork 0
fix: support custom macOS packages in file dialogs #1
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where custom macOS package types (like .rtfd) were not properly recognized in file dialogs when filtering by extension. The fix modifies the UTType creation logic to first attempt creating UTTypes with package conformance before falling back to the regular method.
- Adds a two-stage UTType creation approach: first try with package conformance, then fallback to regular creation
- Ensures custom package extensions like .rtfd are properly recognized in file dialogs
- Maintains backward compatibility with non-package file types
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| UTType* packageType = [UTType typeWithIdentifier:@"com.apple.package"]; | ||
| UTType* utt = [UTType typeWithFilenameExtension:@(ext.c_str()) | ||
| conformingToType:packageType]; |
Copilot
AI
Oct 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The packageType UTType is being created for every file extension in the loop. Consider moving this outside the loop to avoid redundant object creation.
| // necessary for custom macOS packages like .rtfd to be recognized | ||
| // properly in file dialogs. If that fails, fall back to the regular | ||
| // method. | ||
| UTType* packageType = [UTType typeWithIdentifier:@"com.apple.package"]; |
Copilot
AI
Oct 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded string 'com.apple.package' should be defined as a constant to improve maintainability and reduce the risk of typos.
* fix: accentColor set distinguishes the frame * chore: invalid change * fix: lint
Fixes an issue where custom macOS package types (like .rtfd) were not properly recognized in file dialogs when filtering by extension. The problem occurred because UTType creation didn't specify the package conformance, causing the system to not recognize these files as valid packages. The fix attempts to create UTTypes with com.apple.package conformance first, then falls back to the regular method if that fails. This ensures that package extensions like .rtfd are properly recognized while maintaining compatibility with non-package file types. Fixes electron#48191 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
96e18ae to
2bd0c7d
Compare
Fixes an issue where custom macOS package types (like .rtfd) were not properly recognized in file dialogs when filtering by extension. The problem occurred because UTType creation didn't specify the package conformance, causing the system to not recognize these files as valid packages.
The fix attempts to create UTTypes with com.apple.package conformance first, then falls back to the regular method if that fails. This ensures that package extensions like .rtfd are properly recognized while maintaining compatibility with non-package file types.
Fixes electron#48191
🤖 Generated with Claude Code
Description of Change
Checklist
npm testpassesRelease Notes
Notes: