Closed cmbrandenburg closed 7 years ago
Hi @cmbrandenburg , thank you for your suggestion. I totally agree with you that we should change the directory path type to something like Into<PathBuf>
.
But for the filter one, currently we are using name pattern based on the prefix
and suffix
schema. We will name the template using the filename between prefix
and suffix
. If we provide a generic filter, we will lost this schema.
The
DirectorySource
type is constructed using UTF-8 strings. At the least, it should usestd::ffi::OsStr
, but probably it should usestd::path::Path
.This issue is related to https://github.com/sunng87/handlebars-iron/issues/23, where the idea was mentioned but seems to have been dropped.
Because this would be a breaking change, maybe it would make sense to rethink the
DirectorySource
API. Consider the following constructors:The
new_with_extension
method would replace the currentnew
method, whereby the application wants to use all files in a directory (and its subdirectories) with a given extension.Whereas, the
new_with_filter
method would allow applications more flexibility in terms of filtering files based on any custom criteria.