Skip to content

Update FileBrowser.cs #54

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

Closed
wants to merge 1 commit into from
Closed

Conversation

drew-512
Copy link

added ItemPassesFilter delegate -- nicer than extensions :)

added ItemPassesFilter delegate -- nicer than extensions :)
@drew-512
Copy link
Author

SimpleFileBrowser is awesome, thanks!

@yasirkula
Copy link
Owner

I get the idea behind this PR but this isn't something I've seen on any other file browser before. What kind of use-case prompted you to create this feature?

@drew-512
Copy link
Author

Well, I needed SFB to filter for multiple extensions (e.g. *.ext.zip). Offering a custom filter callback seems like a great way to future-proof SFB for any kind of foreseeable file name filter, so it seems like a no-brainer.

I think it's high value when software offers flexibility when it comes at low or no cost.

@yasirkula
Copy link
Owner

You can define multiple extensions in a single filter. Do you mean an extension *.ext.zip where ext part can be any 3-letter string? I honestly have never seen such flexible extensions used anywhere before.

@drew-512
Copy link
Author

drew-512 commented Oct 17, 2021

You can define multiple extensions in a single filter. Do you mean an extension *.ext.zip where ext part can be any 3-letter string? I honestly have never seen such flexible extensions used anywhere before.

No, I'm talking about making a filter that accepts, say, files that only end with ".tar.zip". The current code only looks at the rightmost extension. I'm not getting your resistance around a simple extension to the filter code that makes it possible to perform arbitrary filtering.

@yasirkula yasirkula closed this in f7f5228 Oct 19, 2021
@yasirkula
Copy link
Owner

yasirkula commented Oct 19, 2021

When we follow your way, the issue will still be there for Filter constructors that don't take a ItemPassesFilter parameter (e.g. FileBrowser.SetFilters( true, ".tar.gz" )). After making sure that SetFilters( true, ".tar.gz" ) works correctly (which it does with the latest commit), there's no need for ItemPassesFilter so I don't see a benefit in merging it.

Regardless, thanks for the PR!

@drew-512
Copy link
Author

drew-512 commented Oct 19, 2021

What about someone wanting your use a regex? Your resistance is so strange here -- as if you want your work to be less flexible. There is literally zero downside from adding this -- you are an engineer, correct?

@yasirkula
Copy link
Owner

Tell me about other file browser APIs that let you use a callback function as a callback, tell me about practical use-cases of this feature other than theoretical "you can regex with it" instead of trying to insult me. Just because you've created a feature that you think is useful doesn't make that feature actually useful. Prove me that it's useful. I won't be adding useless features to my plugin. And I take my previous compliment back -- since you're so insistent on being mean -- I won't be thanking you for this PR.

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