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

OpenFilePickerAsync on MacOS cannot select applications #18080

Open
mphipps1 opened this issue Jan 30, 2025 · 4 comments
Open

OpenFilePickerAsync on MacOS cannot select applications #18080

mphipps1 opened this issue Jan 30, 2025 · 4 comments

Comments

@mphipps1
Copy link

mphipps1 commented Jan 30, 2025

Describe the bug

OpenFilePicker works as expected with non-appllications, but applications in the applications folder cannot be selected (nothing is returned, as if "Cancel" was clicked.

Interesting notes:
It's not the Applications folder itself - non-applications placed in the folder can be selected.
It's not the file type - C# files I have compiled can be selected.
It's not that the files are Apple applications - zoom, for example, cannot be selected.

To Reproduce

Call await OpenFilePickerAsync().
Dialog opens.
Choose any non-application file.
Click "OK".
IStorageFile is returned.

Repeat, but choose an application.
Click "OK"
No IStorageFile is returned.

Choosing FileTypeFilter of All or not including a FileTypeFilter doesn't impact this.

Expected behavior

I expect to be able to select any file.
If this is prohibited by the system in some way, feedback (exception, maybe?) that explains what is wrong should be given.

Avalonia version

11.2.1.0

OS

macOS

Additional context

No response

@mphipps1 mphipps1 added the bug label Jan 30, 2025
@maxkatz6
Copy link
Member

MacOS applications (i.e. .app extension) are folders, not files. Which is why it's expected to be IStorageFolder and picked via folder picker.

@mphipps1
Copy link
Author

Thank you. That makes total sense.
That brings me to a design problem, though.
I want to be able to allow the user to select any one "thing". That could be a .app. But it could also be a program that they built themself or even some data type (document, picture, etc).
Is there a control of some sort that can do that?

@maxkatz6
Copy link
Member

maxkatz6 commented Jan 31, 2025

I understand that. But it's also limited by underlying platforms which only allows one or another option not both (dbus, browser). Something like Win32 or macOS picker can be configured to allow both though. We potentially can add new API Task<IEnumerable<IStorageItem>> OpenItemPickerAsync() for these platforms.

Other than that, ManagedFileChooser (call .UseManagedSystemDialogs() in the appbuilder) is one where we could have the most flexibility, as it's a picker completely implemented on Avalonia side (except direct file operations).

@maxkatz6
Copy link
Member

This issue can be changed into a feature request.

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

2 participants