mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
create data dir if it doesn't exist
This commit is contained in:
parent
481a2f41ac
commit
b489af74bd
1 changed files with 6 additions and 0 deletions
|
@ -34,6 +34,12 @@ pub struct GrabberConfig {
|
|||
impl GrabberConfig {
|
||||
|
||||
pub fn parse_directory(directory: &PathBuf) -> Result<ConfigCollection, ConfigError> {
|
||||
// create data dir if it doesn't already exist
|
||||
std::fs::DirBuilder::new()
|
||||
.recursive(true)
|
||||
.create(&directory)
|
||||
.context(ConfigErrorKind::IO)?;
|
||||
|
||||
let paths = fs::read_dir(directory).context(ConfigErrorKind::IO)?;
|
||||
|
||||
let mut collection: collections::HashMap<String, GrabberConfig> = collections::HashMap::new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue