diff --git a/bootstrap.windows.toml b/bootstrap.windows.toml
index f230d76..548f1f3 100644
--- a/bootstrap.windows.toml
+++ b/bootstrap.windows.toml
@@ -1,2 +1,2 @@
name = "yuzu"
-target_url = "https://raw.githubusercontent.com/yuzu-emu/liftinstall/master/config.windows.v3.toml"
+target_url = "https://raw.githubusercontent.com/yuzu-emu/liftinstall/master/config.windows.v4.toml"
diff --git a/config.windows.v2.toml b/config.windows.v2.toml
index 384a88e..54b72b5 100644
--- a/config.windows.v2.toml
+++ b/config.windows.v2.toml
@@ -1,6 +1,6 @@
installing_message = "Reminder: yuzu is an experimental emulator. Stuff will break!"
hide_advanced = true
-new_tool = "https://github.com/yuzu-emu/liftinstall/releases/download/1.1/yuzu_install.exe"
+new_tool = "https://github.com/yuzu-emu/liftinstall/releases/download/1.2/yuzu_install.exe"
[[packages]]
name = "yuzu Nightly"
diff --git a/config.windows.v3.toml b/config.windows.v3.toml
index 92cd464..54b72b5 100644
--- a/config.windows.v3.toml
+++ b/config.windows.v3.toml
@@ -1,5 +1,6 @@
installing_message = "Reminder: yuzu is an experimental emulator. Stuff will break!"
hide_advanced = true
+new_tool = "https://github.com/yuzu-emu/liftinstall/releases/download/1.2/yuzu_install.exe"
[[packages]]
name = "yuzu Nightly"
diff --git a/config.windows.v4.toml b/config.windows.v4.toml
new file mode 100644
index 0000000..92cd464
--- /dev/null
+++ b/config.windows.v4.toml
@@ -0,0 +1,30 @@
+installing_message = "Reminder: yuzu is an experimental emulator. Stuff will break!"
+hide_advanced = true
+
+[[packages]]
+name = "yuzu Nightly"
+description = "The nightly build of yuzu contains already reviewed and tested features."
+default = true
+ [packages.source]
+ name = "github"
+ match = "^yuzu-windows-msvc-[0-9]*-[0-9a-f]*.zip$"
+ [packages.source.config]
+ repo = "yuzu-emu/yuzu-nightly"
+ [[packages.shortcuts]]
+ name = "yuzu Nightly"
+ relative_path = "nightly/yuzu.exe"
+ description = "Launch yuzu (Nightly version)"
+
+[[packages]]
+name = "yuzu Canary"
+description = "The canary build of yuzu has additional features that are still waiting on review."
+ [packages.source]
+ name = "github"
+ match = "^yuzu-windows-msvc-[0-9]*-[0-9a-f]*.zip$"
+ [packages.source.config]
+ repo = "yuzu-emu/yuzu-canary"
+ [[packages.shortcuts]]
+ name = "yuzu Canary"
+ relative_path = "canary/yuzu.exe"
+ description = "Launch yuzu (Canary version)"
+
diff --git a/src/main.rs b/src/main.rs
index 468c7c5..dfffb1f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -141,14 +141,29 @@ fn main() {
to_path.display()
);
- if cfg!(windows) {
- use std::fs::copy;
+ // Attempt it a few times because Windows can hold a lock
+ for i in 1..=5 {
+ let swap_result = if cfg!(windows) {
+ use std::fs::copy;
- copy(¤t_exe, &to_path).log_expect("Unable to copy new installer");
- } else {
- use std::fs::rename;
+ copy(¤t_exe, &to_path).map(|_x| ())
+ } else {
+ use std::fs::rename;
- rename(¤t_exe, &to_path).log_expect("Unable to move new installer");
+ rename(¤t_exe, &to_path)
+ };
+
+ match swap_result {
+ Ok(_) => break,
+ Err(e) => {
+ if i < 5 {
+ info!("Copy attempt failed: {:?}, retrying in 3 seconds.", e);
+ thread::sleep(time::Duration::from_millis(3000));
+ } else {
+ let _: () = Err(e).log_expect("Copying new binary failed");
+ }
+ }
+ }
}
Command::new(to_path)
@@ -158,6 +173,7 @@ fn main() {
exit(0);
}
+ // If we just finished a update, we need to inject our previous command line arguments
let args_file = current_path.join("args.json");
if args_file.exists() {
@@ -170,18 +186,32 @@ fn main() {
matches = reinterpret_app.get_matches_from(database);
- info!("Reparsed command line arguments from original instance");
+ info!("Parsed command line arguments from original instance");
remove_file(args_file).log_expect("Unable to clean up args file");
+ }
- if cfg!(windows) {
- let updater_executable = current_path.join("maintenancetool.exe");
+ // Cleanup any remaining new maintenance tool instances if they exist
+ if cfg!(windows) {
+ let updater_executable = current_path.join("maintenancetool_new.exe");
+ if updater_executable.exists() {
// Sleep a little bit to allow Windows to close the previous file handle
thread::sleep(time::Duration::from_millis(3000));
- if updater_executable.exists() {
- remove_file(updater_executable)
- .log_expect("Unable to clean up previous updater file");
+ // Attempt it a few times because Windows can hold a lock
+ for i in 1..=5 {
+ let swap_result = remove_file(&updater_executable);
+ match swap_result {
+ Ok(_) => break,
+ Err(e) => {
+ if i < 5 {
+ info!("Cleanup attempt failed: {:?}, retrying in 3 seconds.", e);
+ thread::sleep(time::Duration::from_millis(3000));
+ } else {
+ warn!("Deleting temp binary failed after 5 attempts: {:?}", e);
+ }
+ }
+ }
}
}
}