Skip to content

Differentiate between backend not being available and user cancelling the dialog #320

@FloralSoda

Description

@FloralSoda

Issue:
Currently, the pick_folder or pick_file functions return an Option, where None represents both the user cancelling the dialog and the dialog failing to load.

While this crate relies on there being a compatible backend, a user of this crate might want to handle incompatible situations separately. As far as I can see by the documentation, there isn't a good way to do this without making some assumptions about the user's system that may be difficult to maintain.

Use case:
I'm currently writing a TUI app for managing a server application. I want this app to be compatible both with user desktops (for home hosting) and SSH servers (for dedicated hosting). On compatible user desktops, I want to use the system file picker to allow the user to use any shortcuts or other useful features that their file picker has, while on incompatible desktops or SSH servers that don't have a desktop, I want to produce my own more minimal file picker as a substitute.

If the user cancels the dialog, this should result in no action from my application. If the user doesn't have a compatible dialog, the substitute should show up instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions