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

FilePickerOpenOptions returns empty results when filtering for applications #18303

Open
evan-choi opened this issue Feb 24, 2025 · 2 comments
Open

Comments

@evan-choi
Copy link
Contributor

Describe the bug

When trying to use the file picker to select applications on macOS, the picker dialog opens properly but returns empty results after selection.

The issue occurs specifically when setting up FilePickerOpenOptions with the AppleUniformTypeIdentifiers filter com.apple.application.

To Reproduce

var appPickerOptions = new FilePickerOpenOptions
{
    Title = "Select Application",
    FileTypeFilter =
    [
        new FilePickerFileType("Application")
        {
            AppleUniformTypeIdentifiers = ["com.apple.application"]
        }
    ]
};

var results = await StorageProvider.OpenFilePickerAsync(appPickerOptions);
// results is EMPTY!!

Expected behavior

The file picker should return the selected application in the results collection
ex. /System/Applications/FindMy.app

Avalonia version

11.2.4

OS

macOS

Additional context

No response

@evan-choi evan-choi added the bug label Feb 24, 2025
@maxkatz6
Copy link
Member

If you are picking .app "files" - these are folders/directories in fact. OpenFilePickerAsync should have directories filtered out by design.

@evan-choi
Copy link
Contributor Author

If you are picking .app "files" - these are folders/directories in fact. OpenFilePickerAsync should have directories filtered out by design.

Thank you for the clarification. I understand that .app files are technically directories, but in this case, the intent is to select macOS application bundles, which are often represented as .app directories.

While it's true that OpenFilePickerAsync filters files by design, the issue arises because, in the context of macOS applications, selecting .app bundles should be allowed, as they are technically directories but also represent executable applications. If we are to follow the design intent of OpenFilePickerAsync, then perhaps it's worth reconsidering how applications are handled in this specific case.

Alternatively, if modifying FilePicker proves to be challenging, I would appreciate it if FolderPicker could support AppleUniformTypeIdentifiers as an option. This would allow the picker to properly handle the selection of applications without breaking the intended functionality of filtering out regular directories.

By adding this feature, it would make the file picker more flexible and better suited for macOS-specific needs, providing a better user experience when selecting applications.

@MrJul MrJul added the os-macos label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants