You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
417 B
12 lines
417 B
use crate::config::FnmConfig; |
|
use crate::version::Version; |
|
use std::str::FromStr; |
|
|
|
pub fn find_default_version(config: &FnmConfig) -> Option<Version> { |
|
if let Ok(version_path) = config.default_version_dir().canonicalize() { |
|
let file_name = version_path.parent()?.file_name()?; |
|
Version::from_str(file_name.to_str()?).ok()?.into() |
|
} else { |
|
Some(Version::Alias("default".into())) |
|
} |
|
}
|
|
|