Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit 6fabf14

Browse files
authored
Add custom NSIS installation script on Windows (#1125)
This script takes care to uninstall existing installations of bloop ranging from `0.4.8` to `0.5.7`. This is accomplished with a set of checks using known GUIDs against the Windows registry.
1 parent dc71acc commit 6fabf14

File tree

4 files changed

+759
-21
lines changed

4 files changed

+759
-21
lines changed

apps/desktop/src-tauri/build.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,30 @@ fn main() {
3333
fn copy(profile_dir: &Path) {
3434
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
3535

36-
let (dylib_name, target_path) = match target_os.as_str() {
36+
let (dylib_names, target_parent) = match target_os.as_str() {
3737
"macos" => {
3838
let name = "libonnxruntime.dylib";
39-
(name, Path::new(".").join("frameworks").join(name))
39+
(vec![name], Path::new(".").join("frameworks"))
4040
}
4141
"linux" => {
4242
let name = "libonnxruntime.so";
43-
(name, Path::new(".").join("dylibs").join(name))
43+
(vec![name], Path::new(".").join("dylibs"))
44+
}
45+
"windows" => {
46+
let main = "onnxruntime.dll";
47+
let providers = "onnxruntime_providers_shared.dll";
48+
(vec![main, providers], Path::new(".").join("dylibs"))
4449
}
45-
"windows" => return,
4650
other => panic!("unknown OS {other}"),
4751
};
4852

49-
let dylib_path = profile_dir.join(dylib_name);
50-
wait_for(&dylib_path);
51-
println!("target: {target_path:?}, {:?}", env::current_dir());
52-
fs::copy(dylib_path, target_path).unwrap();
53+
for dylib_name in dylib_names {
54+
let dylib_path = profile_dir.join(dylib_name);
55+
let target_path = target_parent.join(dylib_name);
56+
wait_for(&dylib_path);
57+
println!("target: {target_path:?}, {:?}", env::current_dir());
58+
fs::copy(dylib_path, target_path).unwrap();
59+
}
5360
}
5461

5562
fn wait_for(dylib_path: &Path) {

0 commit comments

Comments
 (0)