mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 17:08:51 +00:00
clean code and remove all warning
This commit is contained in:
parent
aa151b8697
commit
3e48dbd68a
@ -3,13 +3,16 @@ use std::{path::PathBuf, sync::Arc};
|
||||
use downloader::progress::Reporter;
|
||||
|
||||
pub trait ComponentDownloader {
|
||||
#[allow(async_fn_in_trait)]
|
||||
async fn install<P: Reporter + 'static>(&self, progress: Option<Arc<P>>) -> anyhow::Result<()>;
|
||||
|
||||
//the 'static is something to change, I don't very like it, but it's for testing purpose
|
||||
#[allow(async_fn_in_trait)]
|
||||
async fn download<P: Reporter + 'static>(
|
||||
output_dir: &PathBuf,
|
||||
progress: Option<Arc<P>>,
|
||||
) -> anyhow::Result<PathBuf>;
|
||||
|
||||
#[allow(async_fn_in_trait)]
|
||||
async fn uncompress(file: PathBuf, new_filename: PathBuf) -> anyhow::Result<()>;
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
use std::{
|
||||
fs::{remove_dir, remove_file, rename, File},
|
||||
fs::{remove_file, rename, File},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use downloader::{Download, Downloader};
|
||||
use downloader::Downloader;
|
||||
use flate2::read::GzDecoder;
|
||||
use tar::Archive;
|
||||
use tokio::fs::remove_dir_all;
|
||||
|
||||
@ -1,19 +1,12 @@
|
||||
use downloader::progress;
|
||||
use downloader::progress::Reporter;
|
||||
use downloader::Downloader;
|
||||
use log::debug;
|
||||
use log::info;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::collections::TryReserveError;
|
||||
use std::fs as std_fs;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
use std::vec;
|
||||
use tokio::fs::File;
|
||||
|
||||
use downloader::Downloader;
|
||||
use log::debug;
|
||||
use log::info;
|
||||
use tokio::fs::{create_dir_all, remove_file};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
@ -183,8 +176,8 @@ impl ComponentDownloader for GameComponent {
|
||||
}
|
||||
|
||||
async fn uncompress(
|
||||
file: std::path::PathBuf,
|
||||
new_filename: std::path::PathBuf,
|
||||
_file: std::path::PathBuf,
|
||||
_new_filename: std::path::PathBuf,
|
||||
) -> anyhow::Result<()> {
|
||||
panic!("How did you run this function??!!")
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
env::home_dir,
|
||||
fs::{create_dir, remove_file, rename, File},
|
||||
fs::{remove_file, rename, File},
|
||||
path::PathBuf,
|
||||
str::FromStr,
|
||||
sync::Arc,
|
||||
@ -10,11 +9,10 @@ use downloader::{progress::Reporter, Downloader};
|
||||
use flate2::read::GzDecoder;
|
||||
use log::debug;
|
||||
use tar::Archive;
|
||||
use wincompatlib::wine::{bundle::proton::Proton, ext::WineBootExt};
|
||||
use xz::read::XzDecoder;
|
||||
use wincompatlib::wine::ext::WineBootExt;
|
||||
|
||||
use super::component_downloader::ComponentDownloader;
|
||||
use crate::{game_state::GameState, utils::github_requester::GithubRequester};
|
||||
use crate::utils::github_requester::GithubRequester;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct ProtonComponent {
|
||||
|
||||
@ -1,27 +1,14 @@
|
||||
use std::{
|
||||
fs::{create_dir, remove_file, rename, File},
|
||||
io::{BufRead, BufReader},
|
||||
path::PathBuf,
|
||||
str::FromStr,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use downloader::progress::Reporter;
|
||||
use flate2::read::GzDecoder;
|
||||
use log::{debug, info};
|
||||
use tar::Archive;
|
||||
use tokio::fs::create_dir_all;
|
||||
use tokio::time::sleep;
|
||||
use wincompatlib::{prelude::*, wine::bundle::proton};
|
||||
use xz::read::XzDecoder;
|
||||
use wincompatlib::prelude::*;
|
||||
|
||||
use crate::{
|
||||
components::{
|
||||
component_downloader::ComponentDownloader,
|
||||
dxvk_component::{self, DXVKComponent},
|
||||
game_component::GameComponent,
|
||||
proton_component::ProtonComponent,
|
||||
component_downloader::ComponentDownloader, dxvk_component::DXVKComponent,
|
||||
game_component::GameComponent, proton_component::ProtonComponent,
|
||||
},
|
||||
game_patcher,
|
||||
game_state::GameState,
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
use std::{
|
||||
io::Read,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use std::{io::Read, path::PathBuf};
|
||||
|
||||
use dirs::executable_dir;
|
||||
use log::debug;
|
||||
use rust_embed::RustEmbed;
|
||||
use tokio::{
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
use dirs::home_dir;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
use tokio::{
|
||||
fs::{create_dir_all, read_to_string, File},
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
io::AsyncWriteExt,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
|
||||
use reqwest::header::{self, USER_AGENT};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -65,6 +63,7 @@ pub trait GithubRequester {
|
||||
.expect("Failed to build https client")
|
||||
}
|
||||
|
||||
#[allow(async_fn_in_trait)]
|
||||
async fn get_latest_github_release(
|
||||
user: &str,
|
||||
repo_name: &str,
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use log::debug;
|
||||
use reqwest::header::USER_AGENT;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user