cleanup
This commit is contained in:
parent
f582cdd625
commit
1e62b5ffad
@ -374,9 +374,7 @@ fn arg_remove_value(args: &mut Vec<String>, arg: &str) {
|
|||||||
async fn main() {
|
async fn main() {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
setup_env();
|
setup_env();
|
||||||
|
|
||||||
let mut args: Vec<String> = env::args().collect();
|
let mut args: Vec<String> = env::args().collect();
|
||||||
let original_args = args.clone();
|
|
||||||
|
|
||||||
if arg_bool(&args, "--help") {
|
if arg_bool(&args, "--help") {
|
||||||
println!("CLI Args:");
|
println!("CLI Args:");
|
||||||
@ -429,7 +427,7 @@ async fn main() {
|
|||||||
let mut cfg = config::load(install_path.join("alterware-launcher.json"));
|
let mut cfg = config::load(install_path.join("alterware-launcher.json"));
|
||||||
|
|
||||||
if !arg_bool(&args, "--skip-launcher-update") && !cfg.skip_self_update {
|
if !arg_bool(&args, "--skip-launcher-update") && !cfg.skip_self_update {
|
||||||
self_update::run(cfg.update_only, original_args);
|
self_update::run(cfg.update_only);
|
||||||
} else {
|
} else {
|
||||||
arg_remove(&mut args, "--skip-launcher-update");
|
arg_remove(&mut args, "--skip-launcher-update");
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ pub fn run(_update_only: bool, _args: Vec<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn restart(args: Vec<String>) -> std::io::Error {
|
pub fn restart() -> std::io::Error {
|
||||||
use std::os::windows::process::CommandExt;
|
use std::os::windows::process::CommandExt;
|
||||||
match std::process::Command::new(std::env::current_exe().unwrap())
|
match std::process::Command::new(std::env::current_exe().unwrap())
|
||||||
.args(args.into_iter().skip(1))
|
.args(std::env::args().skip(1))
|
||||||
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE
|
.creation_flags(0x00000010) // CREATE_NEW_CONSOLE
|
||||||
.spawn()
|
.spawn()
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ pub fn restart(args: Vec<String>) -> std::io::Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub fn run(update_only: bool, args: Vec<String>) {
|
pub fn run(update_only: bool) {
|
||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
|
|
||||||
use crate::http;
|
use crate::http;
|
||||||
@ -81,7 +81,7 @@ pub fn run(update_only: bool, args: Vec<String>) {
|
|||||||
} else {
|
} else {
|
||||||
"alterware-launcher.exe"
|
"alterware-launcher.exe"
|
||||||
};
|
};
|
||||||
println!("{}", launcher_name);
|
|
||||||
http::download_file(
|
http::download_file(
|
||||||
&format!(
|
&format!(
|
||||||
"{}/download/{}",
|
"{}/download/{}",
|
||||||
@ -101,7 +101,7 @@ pub fn run(update_only: bool, args: Vec<String>) {
|
|||||||
|
|
||||||
// restarting spawns a new console, automation should manually restart on exit code 201
|
// restarting spawns a new console, automation should manually restart on exit code 201
|
||||||
if !update_only {
|
if !update_only {
|
||||||
let restart_error = restart(args).to_string();
|
let restart_error = restart().to_string();
|
||||||
println!("Failed to restart launcher: {}", restart_error);
|
println!("Failed to restart launcher: {}", restart_error);
|
||||||
println!("Please restart the launcher manually.");
|
println!("Please restart the launcher manually.");
|
||||||
misc::stdin();
|
misc::stdin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user