default to Eapi 0 if no eapi file exists
This commit is contained in:
@@ -64,7 +64,7 @@ pub enum Error {
|
|||||||
pub struct Profile {
|
pub struct Profile {
|
||||||
#[get(kind = "deref")]
|
#[get(kind = "deref")]
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
eapi: Option<Eapi>,
|
eapi: Eapi,
|
||||||
deprecated: Option<String>,
|
deprecated: Option<String>,
|
||||||
#[get(kind = "deref")]
|
#[get(kind = "deref")]
|
||||||
parents: Vec<Profile>,
|
parents: Vec<Profile>,
|
||||||
@@ -108,9 +108,9 @@ impl Profile {
|
|||||||
let eapi = match fs::read_to_string(&eapi_path)
|
let eapi = match fs::read_to_string(&eapi_path)
|
||||||
.map(|s| Eapi::parse(s.trim()).map_err(str::to_string))
|
.map(|s| Eapi::parse(s.trim()).map_err(str::to_string))
|
||||||
{
|
{
|
||||||
Ok(Ok(eapi)) => Some(eapi),
|
Ok(Ok(eapi)) => eapi,
|
||||||
Ok(Err(rest)) => return Err(Error::Parser(rest)),
|
Ok(Err(rest)) => return Err(Error::Parser(rest)),
|
||||||
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => None,
|
Err(e) if matches!(e.kind(), io::ErrorKind::NotFound) => Eapi::parse("0").unwrap(),
|
||||||
Err(e) => return Err(Error::Io(eapi_path, e)),
|
Err(e) => return Err(Error::Io(eapi_path, e)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user