commit
4763759997
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -28,7 +28,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alterware-launcher"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
dependencies = [
|
||||
"colored",
|
||||
"futures-util",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "alterware-launcher"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
edition = "2021"
|
||||
build = "res/build.rs"
|
||||
|
||||
|
@ -374,7 +374,6 @@ fn arg_remove_value(args: &mut Vec<String>, arg: &str) {
|
||||
async fn main() {
|
||||
#[cfg(windows)]
|
||||
setup_env();
|
||||
|
||||
let mut args: Vec<String> = env::args().collect();
|
||||
|
||||
if arg_bool(&args, "--help") {
|
||||
|
@ -25,6 +25,19 @@ pub fn run(_update_only: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn restart() -> std::io::Error {
|
||||
use std::os::windows::process::CommandExt;
|
||||
match std::process::Command::new(std::env::current_exe().unwrap())
|
||||
.args(std::env::args().skip(1))
|
||||
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE
|
||||
.spawn()
|
||||
{
|
||||
Ok(_) => std::process::exit(0),
|
||||
Err(err) => err,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn run(update_only: bool) {
|
||||
use std::{fs, path::PathBuf};
|
||||
@ -68,7 +81,7 @@ pub fn run(update_only: bool) {
|
||||
} else {
|
||||
"alterware-launcher.exe"
|
||||
};
|
||||
println!("{}", launcher_name);
|
||||
|
||||
http::download_file(
|
||||
&format!(
|
||||
"{}/download/{}",
|
||||
@ -85,12 +98,12 @@ pub fn run(update_only: bool) {
|
||||
|
||||
self_replace::self_replace("alterware-launcher-update.exe").unwrap();
|
||||
fs::remove_file(&file_path).unwrap();
|
||||
println!(
|
||||
"Launcher updated. View the changelog at https://github.com/{}/{}/releases/latest",
|
||||
GH_OWNER, GH_REPO,
|
||||
);
|
||||
println!("Please restart the launcher.");
|
||||
|
||||
// restarting spawns a new console, automation should manually restart on exit code 201
|
||||
if !update_only {
|
||||
let restart_error = restart().to_string();
|
||||
println!("Failed to restart launcher: {}", restart_error);
|
||||
println!("Please restart the launcher manually.");
|
||||
misc::stdin();
|
||||
}
|
||||
std::process::exit(201);
|
||||
|
Loading…
Reference in New Issue
Block a user