mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
take regex config value
This commit is contained in:
parent
bd49ae8c6f
commit
c34f435153
2 changed files with 3 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ pub struct Preload {
|
|||
}
|
||||
|
||||
impl Preload {
|
||||
pub fn init(directory: &str, regex: Option<&str>, clear: bool) -> Result<Self> {
|
||||
pub fn init(directory: &str, regex: Option<String>, clear: bool) -> Result<Self> {
|
||||
let path = PathBuf::from_str(directory)?;
|
||||
if let Ok(t) = fs::metadata(&path) {
|
||||
if t.is_file() {
|
||||
|
|
@ -28,7 +28,7 @@ impl Preload {
|
|||
fs::create_dir_all(&path)?;
|
||||
Ok(Self {
|
||||
path,
|
||||
regex: regex.map(|r| Regex::new(r).unwrap()),
|
||||
regex: regex.map(|r| Regex::new(&r).unwrap()),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue