mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-07 15:55:53 +00:00
Refactor
This commit is contained in:
parent
f1a0b02065
commit
b7a1b34397
@ -8,6 +8,7 @@ mod window;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use anyhow::anyhow;
|
||||||
use fj_host::{Model, Parameters};
|
use fj_host::{Model, Parameters};
|
||||||
use fj_interop::{debug::DebugInfo, mesh::Mesh};
|
use fj_interop::{debug::DebugInfo, mesh::Mesh};
|
||||||
use fj_kernel::algorithms::{triangulate, Tolerance};
|
use fj_kernel::algorithms::{triangulate, Tolerance};
|
||||||
@ -48,17 +49,13 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let config = Config::load()?;
|
let config = Config::load()?;
|
||||||
|
|
||||||
let mut path = config.default_path.unwrap_or_else(|| PathBuf::from(""));
|
let mut path = config.default_path.unwrap_or_else(|| PathBuf::from(""));
|
||||||
match args.model.or(config.default_model) {
|
let model = args.model.or(config.default_model).ok_or_else(|| {
|
||||||
Some(model) => {
|
anyhow!(
|
||||||
path.push(model);
|
"No model specified, and no default model configured.\n\
|
||||||
}
|
|
||||||
None => {
|
|
||||||
anyhow::bail!(
|
|
||||||
"No model specified, and no default model configured.\n\
|
|
||||||
Specify a model by passing `--model path/to/model`."
|
Specify a model by passing `--model path/to/model`."
|
||||||
);
|
)
|
||||||
}
|
})?;
|
||||||
}
|
path.push(model);
|
||||||
|
|
||||||
let model = Model::from_path(path, config.target_dir)?;
|
let model = Model::from_path(path, config.target_dir)?;
|
||||||
let parameters = args.parameters.unwrap_or_else(Parameters::empty);
|
let parameters = args.parameters.unwrap_or_else(Parameters::empty);
|
||||||
|
Loading…
Reference in New Issue
Block a user