mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-15 12:47:19 +00:00
parent
75db7adc28
commit
d1cc3f33b7
@ -45,18 +45,29 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
let args = Args::parse();
|
||||
let config = Config::load()?;
|
||||
|
||||
let path = config.default_path.unwrap_or_else(|| PathBuf::from(""));
|
||||
let parameters = args.parameters.unwrap_or_else(Parameters::empty);
|
||||
let shape_processor = ShapeProcessor {
|
||||
tolerance: args.tolerance,
|
||||
};
|
||||
|
||||
let model = if let Some(model) = args.model.or(config.default_model) {
|
||||
let path_of_model = path.canonicalize().unwrap_or_default();
|
||||
|
||||
let model = if let Some(model) =
|
||||
args.model.or(config.default_model).as_ref()
|
||||
{
|
||||
let mut model_path = path;
|
||||
model_path.push(model);
|
||||
Some(Model::from_path(model_path.clone()).with_context(|| {
|
||||
format!("Failed to load model: {}", model_path.display())
|
||||
if path_of_model.as_os_str().is_empty() {
|
||||
format!(
|
||||
"Model is not defined, can't find model defined inside the default-model also, add model like \n cargo run -- -m {}", model.display()
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"Failed to load model: {0}\ninside default models directory: '{1}'\nCan mainly caused by: \n1. Model '{2}' can not be found inside '{1}'\n2.'{2}' can be mis-typed see inside '{1}' for a match\n3. Define model is '{2}' couldn\'t be found ((defined in command-line arguments))", model_path.display(), path_of_model.display(), model.display()
|
||||
)
|
||||
}
|
||||
})?)
|
||||
} else {
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user