Skip to content

Commit 7d14a45

Browse files
committed
Keep updater/tests/app-updater/src/main.rs lf
1 parent fc85f3b commit 7d14a45

File tree

1 file changed

+56
-56
lines changed
  • plugins/updater/tests/app-updater/src

1 file changed

+56
-56
lines changed
Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2-
// SPDX-License-Identifier: Apache-2.0
3-
// SPDX-License-Identifier: MIT
4-
5-
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
6-
7-
use tauri_plugin_updater::UpdaterExt;
8-
9-
fn main() {
10-
#[allow(unused_mut)]
11-
let mut context = tauri::generate_context!();
12-
tauri::Builder::default()
13-
.plugin(tauri_plugin_updater::Builder::new().build())
14-
.setup(|app| {
15-
let handle = app.handle().clone();
16-
tauri::async_runtime::spawn(async move {
17-
let mut builder = handle.updater_builder();
18-
if std::env::var("TARGET").unwrap_or_default() == "nsis" {
19-
// /D sets the default installation directory ($INSTDIR),
20-
// overriding InstallDir and InstallDirRegKey.
21-
// It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
22-
// Only absolute paths are supported.
23-
// NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder
24-
builder = builder.installer_args(vec![format!(
25-
"/D={}",
26-
tauri::utils::platform::current_exe()
27-
.unwrap()
28-
.parent()
29-
.unwrap()
30-
.display()
31-
)]);
32-
}
33-
let updater = builder.build().unwrap();
34-
35-
match updater.check().await {
36-
Ok(Some(update)) => {
37-
if let Err(e) = update.download_and_install(|_, _| {}, || {}).await {
38-
println!("{e}");
39-
std::process::exit(1);
40-
}
41-
std::process::exit(0);
42-
}
43-
Ok(None) => {
44-
std::process::exit(2);
45-
}
46-
Err(e) => {
47-
println!("{e}");
48-
std::process::exit(1);
49-
}
50-
}
51-
});
52-
Ok(())
53-
})
54-
.run(context)
55-
.expect("error while running tauri application");
56-
}
1+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2+
// SPDX-License-Identifier: Apache-2.0
3+
// SPDX-License-Identifier: MIT
4+
5+
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
6+
7+
use tauri_plugin_updater::UpdaterExt;
8+
9+
fn main() {
10+
#[allow(unused_mut)]
11+
let mut context = tauri::generate_context!();
12+
tauri::Builder::default()
13+
.plugin(tauri_plugin_updater::Builder::new().build())
14+
.setup(|app| {
15+
let handle = app.handle().clone();
16+
tauri::async_runtime::spawn(async move {
17+
let mut builder = handle.updater_builder();
18+
if std::env::var("TARGET").unwrap_or_default() == "nsis" {
19+
// /D sets the default installation directory ($INSTDIR),
20+
// overriding InstallDir and InstallDirRegKey.
21+
// It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
22+
// Only absolute paths are supported.
23+
// NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder
24+
builder = builder.installer_args(vec![format!(
25+
"/D={}",
26+
tauri::utils::platform::current_exe()
27+
.unwrap()
28+
.parent()
29+
.unwrap()
30+
.display()
31+
)]);
32+
}
33+
let updater = builder.build().unwrap();
34+
35+
match updater.check().await {
36+
Ok(Some(update)) => {
37+
if let Err(e) = update.download_and_install(|_, _| {}, || {}).await {
38+
println!("{e}");
39+
std::process::exit(1);
40+
}
41+
std::process::exit(0);
42+
}
43+
Ok(None) => {
44+
std::process::exit(2);
45+
}
46+
Err(e) => {
47+
println!("{e}");
48+
std::process::exit(1);
49+
}
50+
}
51+
});
52+
Ok(())
53+
})
54+
.run(context)
55+
.expect("error while running tauri application");
56+
}

0 commit comments

Comments
 (0)