globset: Default for literal_separator #2940
-
I came across this through an application that uses the This also supported by the man page for glob:
What is the reason behind |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I followed And it's also how Python's
I don't think there is any one commonly accepted default. And it depends on context. For a crate like To be honest, globbing is a bit of a mess. And like regex, pretty much all implementations have their own little quirks and features. |
Beta Was this translation helpful? Give feedback.
I followed
glob
's example.And it's also how Python's
fnmatch
module works:I don't think there is any one commonly accepted default. And it depends on context. For a crate like
globset
, it's common to pass a full path to it. And in that context, it's reasonable to expect that things like*.txt
matchfoo/bar.txt
. But in the context of something likeglob(7)
, it's more common to execute a glob in the context of a single directory where you don't expect*
to traverse into sub-directories.To be honest, globbing is a bit of a mess. And like regex, pretty much all implementations have their own little quirks and features.