Compare commits
No commits in common. "4d8883218cd5fb81f82046e6efe45dd4afd29ff2" and "06a8fcd807b27866c5aae5e21db0b96077000f0e" have entirely different histories.
4d8883218c
...
06a8fcd807
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -550,7 +550,6 @@ dependencies = [
|
|||
"anyhow",
|
||||
"glob",
|
||||
"reqwest",
|
||||
"winapi",
|
||||
"winres",
|
||||
"zip",
|
||||
]
|
||||
|
|
|
@ -5,10 +5,9 @@ edition = "2021"
|
|||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.11.22", features = ["blocking"] }
|
||||
winapi = { version = "0.3", features = ["wincon"] }
|
||||
anyhow = "1.0.75"
|
||||
glob = "0.3.1"
|
||||
reqwest = { version = "0.11.22", features = ["blocking"] }
|
||||
zip = "0.6.6"
|
||||
|
||||
[build-dependencies]
|
||||
|
|
30
src/main.rs
30
src/main.rs
|
@ -1,12 +1,8 @@
|
|||
use anyhow::Context;
|
||||
use launcher::{apply_zip, download};
|
||||
use std::env;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::os::windows::process::CommandExt;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::process::Stdio;
|
||||
use std::{env::set_current_dir, fs, io, process::Command};
|
||||
use winapi::um::winbase::DETACHED_PROCESS;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// Move to the project directory
|
||||
|
@ -42,16 +38,10 @@ fn main() -> anyhow::Result<()> {
|
|||
apply_zip("config")?;
|
||||
apply_zip("mods")?;
|
||||
|
||||
// unsafe { winapi::um::wincon::FreeConsole() };
|
||||
|
||||
// Launch the game
|
||||
println!("Launching game...");
|
||||
let process = Command::new("data/runtime/bin/java.exe")
|
||||
.creation_flags(DETACHED_PROCESS)
|
||||
.current_dir("data/game")
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.stdin(Stdio::null())
|
||||
set_current_dir("data/game")?;
|
||||
Command::new("../runtime/bin/java.exe")
|
||||
.args([
|
||||
"-cp",
|
||||
"../libraries/*",
|
||||
|
@ -63,19 +53,7 @@ fn main() -> anyhow::Result<()> {
|
|||
"--username",
|
||||
username.trim(),
|
||||
])
|
||||
.spawn()?;
|
||||
|
||||
let reader = BufReader::new(process.stdout.context("no stdout")?);
|
||||
for line in reader.lines() {
|
||||
let line = line?;
|
||||
if line
|
||||
.trim()
|
||||
.ends_with("Backend library: LWJGL version 3.3.1 SNAPSHOT")
|
||||
{
|
||||
break;
|
||||
}
|
||||
println!("{line}");
|
||||
}
|
||||
.status()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue