mirror of
https://github.com/orhun/systeroid
synced 2024-07-25 04:14:13 +00:00
fix(parser): filter out empty file names while checking
This commit is contained in:
parent
90fb9d504c
commit
f0b58bcf21
|
@ -48,13 +48,16 @@ impl<'a> Parser<'a> {
|
||||||
if glob_files.is_empty() {
|
if glob_files.is_empty() {
|
||||||
return Err(Error::EmptyFileListError);
|
return Err(Error::EmptyFileListError);
|
||||||
}
|
}
|
||||||
self.required_files.iter().try_for_each(|file_name| {
|
self.required_files
|
||||||
glob_files
|
.iter()
|
||||||
.iter()
|
.filter(|file_name| !file_name.is_empty())
|
||||||
.find(|file| file.file_name().to_str() == Some(file_name))
|
.try_for_each(|file_name| {
|
||||||
.map(drop)
|
glob_files
|
||||||
.ok_or_else(|| Error::MissingFileError(file_name.to_string()))
|
.iter()
|
||||||
})?;
|
.find(|file| file.file_name().to_str() == Some(file_name))
|
||||||
|
.map(drop)
|
||||||
|
.ok_or_else(|| Error::MissingFileError(file_name.to_string()))
|
||||||
|
})?;
|
||||||
for file in glob_files {
|
for file in glob_files {
|
||||||
let input = if file.path().extension().and_then(|ext| ext.to_str()) == Some("gz") {
|
let input = if file.path().extension().and_then(|ext| ext.to_str()) == Some("gz") {
|
||||||
reader::read_gzip(file.path())?
|
reader::read_gzip(file.path())?
|
||||||
|
|
Loading…
Reference in a new issue