fix: check for file presence after download
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
use std::{error::Error, process::Command};
|
||||
use std::{error::Error, fs, process::Command};
|
||||
|
||||
use shy_launcher::{config::Config, downloader};
|
||||
|
||||
@@ -10,6 +10,15 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
println!("Starting download...");
|
||||
downloader::download(config.downloads()).await;
|
||||
|
||||
println!("Verifying file presence...");
|
||||
for download in config.downloads() {
|
||||
let filename = download.filename();
|
||||
if !fs::exists(filename)? {
|
||||
panic!("Required file {} not present", filename);
|
||||
}
|
||||
println!("[ok] {}", filename);
|
||||
}
|
||||
|
||||
println!("Freeing memory...");
|
||||
if unsafe { libc::malloc_trim(0) } == 1 {
|
||||
println!("Freed up some memory.");
|
||||
|
||||
Reference in New Issue
Block a user