Skip to content

Commit

Permalink
Merge pull request #107 from hannobraun/model-name-dash
Browse files Browse the repository at this point in the history
Fix model loading error, if name contains '-'
  • Loading branch information
hannobraun authored Jan 28, 2022
2 parents a61b1d7 + 5e0d5d7 commit f4b4dec
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ impl Model {
}

pub fn lib_path(&self) -> String {
let path = format!("{}/target/debug/", self.path(),);
let file: String;
if cfg!(windows) {
file = format!("{}.dll", self.name())
let name = self.name().replace("-", "_");

let file = if cfg!(windows) {
format!("{}.dll", name)
} else if cfg!(target_os = "macos") {
file = format!("lib{}.dylib", self.name())
format!("lib{}.dylib", name)
} else {
//Unix
file = format!("lib{}.so", self.name())
}
format!("{}{}", path, file)
format!("lib{}.so", name)
};

format!("{}/target/debug/{}", self.path(), file)
}

pub fn load(
Expand Down

0 comments on commit f4b4dec

Please sign in to comment.