Closed drew-512 closed 3 years ago
SimpleFileBrowser is awesome, thanks!
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?
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.
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.
You can define multiple extensions in a single filter. Do you mean an extension
*.ext.zip
whereext
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.
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!
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?
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.
added ItemPassesFilter delegate -- nicer than extensions :)