mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-26 09:44:40 +10:00
refactor: Ran cargo clippy & cargo fmt
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
@@ -2,7 +2,7 @@ use std::{
|
|||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::{self, create_dir_all},
|
fs::{self, create_dir_all},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{LazyLock, Mutex, RwLock},
|
sync::{LazyLock, Mutex},
|
||||||
};
|
};
|
||||||
|
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
@@ -11,8 +11,6 @@ use rustbreak::{deser::Bincode, PathDatabase};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{AppState, DB};
|
|
||||||
|
|
||||||
#[derive(serde::Serialize, Clone, Deserialize)]
|
#[derive(serde::Serialize, Clone, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DatabaseAuth {
|
pub struct DatabaseAuth {
|
||||||
@@ -97,4 +95,4 @@ pub fn change_root_directory(new_dir: String) {
|
|||||||
info!("Changed root directory to {}", new_dir);
|
info!("Changed root directory to {}", new_dir);
|
||||||
let mut lock = DATA_ROOT_DIR.lock().unwrap();
|
let mut lock = DATA_ROOT_DIR.lock().unwrap();
|
||||||
*lock = new_dir.into();
|
*lock = new_dir.into();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,12 @@ impl GameDownloadAgent {
|
|||||||
game_id: String,
|
game_id: String,
|
||||||
) -> Result<(), GameDownloadError> {
|
) -> Result<(), GameDownloadError> {
|
||||||
let mut contexts = Vec::new();
|
let mut contexts = Vec::new();
|
||||||
let base_path = DATA_ROOT_DIR.lock().unwrap().join("games").join(game_id.clone()).clone();
|
let base_path = DATA_ROOT_DIR
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.join("games")
|
||||||
|
.join(game_id.clone())
|
||||||
|
.clone();
|
||||||
create_dir_all(base_path.clone()).unwrap();
|
create_dir_all(base_path.clone()).unwrap();
|
||||||
info!("Generating contexts");
|
info!("Generating contexts");
|
||||||
for (raw_path, chunk) in manifest {
|
for (raw_path, chunk) in manifest {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ pub async fn get_game_download_progress(
|
|||||||
pub async fn set_download_state(
|
pub async fn set_download_state(
|
||||||
state: tauri::State<'_, Mutex<AppState>>,
|
state: tauri::State<'_, Mutex<AppState>>,
|
||||||
game_id: String,
|
game_id: String,
|
||||||
status: GameDownloadState
|
status: GameDownloadState,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
info!("Setting game state");
|
info!("Setting game state");
|
||||||
get_game_download(state, game_id).change_state(status);
|
get_game_download(state, game_id).change_state(status);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::{auth::generate_authorization_header, GAME_PAUSE_CHECK_INTERVAL};
|
|
||||||
use crate::db::DatabaseImpls;
|
use crate::db::DatabaseImpls;
|
||||||
use crate::downloads::manifest::DropDownloadContext;
|
use crate::downloads::manifest::DropDownloadContext;
|
||||||
use crate::DB;
|
use crate::DB;
|
||||||
|
use crate::{auth::generate_authorization_header, GAME_PAUSE_CHECK_INTERVAL};
|
||||||
use atomic_counter::{AtomicCounter, RelaxedCounter};
|
use atomic_counter::{AtomicCounter, RelaxedCounter};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use md5::{Context, Digest};
|
use md5::{Context, Digest};
|
||||||
|
|||||||
Reference in New Issue
Block a user