mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-25 00:25:51 +00:00
Accept optional target_dir
in Model::from_path
This commit is contained in:
parent
ff20d332c2
commit
99d0ca2b89
@ -68,7 +68,7 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let model = Model::from_path(path)?;
|
||||
let model = Model::from_path(path, None)?;
|
||||
|
||||
let mut parameters = HashMap::new();
|
||||
for parameter in args.parameters {
|
||||
|
@ -9,7 +9,10 @@ pub struct Model {
|
||||
}
|
||||
|
||||
impl Model {
|
||||
pub fn from_path(path: PathBuf) -> io::Result<Self> {
|
||||
pub fn from_path(
|
||||
path: PathBuf,
|
||||
target_dir: Option<PathBuf>,
|
||||
) -> io::Result<Self> {
|
||||
let name = {
|
||||
// Can't panic. It only would, if the path ends with "..", and we
|
||||
// are canonicalizing it here to prevent that.
|
||||
@ -31,7 +34,8 @@ impl Model {
|
||||
format!("lib{}.so", name)
|
||||
};
|
||||
|
||||
path.join("target/debug").join(file)
|
||||
let target_dir = target_dir.unwrap_or_else(|| path.join("target"));
|
||||
target_dir.join("debug").join(file)
|
||||
};
|
||||
|
||||
let manifest_path = path.join("Cargo.toml");
|
||||
|
Loading…
Reference in New Issue
Block a user