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