Compare commits

..

3 Commits

Author SHA1 Message Date
a2d1a989e0 Fix folders not opening (#162) 2025-10-17 15:27:32 +11:00
83d2301056 Fix macOS build 2025-10-16 15:32:28 +11:00
87bbe1da49 156 refactor into workspaces (#157)
* chore: Major refactoring

Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example

Signed-off-by: quexeky <git@quexeky.dev>

* fix: Remote tauri dependency from process

Signed-off-by: quexeky <git@quexeky.dev>

* refactor: Improvements to src-tauri

Signed-off-by: quexeky <git@quexeky.dev>

* refactor: Builds, but some logic still left to move back

Signed-off-by: quexeky <git@quexeky.dev>

* refactor: Finish refactor

Signed-off-by: quexeky <git@quexeky.dev>

* chore: Run cargo clippy && cargo fmt

Signed-off-by: quexeky <git@quexeky.dev>

* refactor: Move everything into src-tauri

Signed-off-by: quexeky <git@quexeky.dev>

---------

Signed-off-by: quexeky <git@quexeky.dev>
2025-10-14 17:12:51 +11:00
84 changed files with 1444 additions and 9280 deletions

8303
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
[workspace]
members = [
"client",
"database",
"src-tauri",
"process",
"remote",
"utils",
"cloud_saves",
"download_manager",
"games", "drop-consts",
]
resolver = "3"

View File

@ -1,7 +0,0 @@
[package]
name = "drop-consts"
version = "0.1.0"
edition = "2024"
[dependencies]
dirs = "6.0.0"

View File

@ -1,23 +0,0 @@
use std::{cell::LazyCell, path::PathBuf};
#[cfg(not(debug_assertions))]
pub const DATA_ROOT_PREFIX: &str = "drop";
#[cfg(debug_assertions)]
pub const DATA_ROOT_PREFIX: &str = "drop-debug";
pub const DATA_ROOT_DIR: LazyCell<PathBuf> = LazyCell::new(|| {
dirs::data_dir()
.expect("Failed to get data dir")
.join(DATA_ROOT_PREFIX)
});
pub const DROP_DATA_PATH: &str = ".dropdata";
// Downloads
pub const MAX_PACKET_LENGTH: usize = 4096 * 4;
pub const BUMP_SIZE: usize = 4096 * 16;
pub const RETRY_COUNT: usize = 3;
pub const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000;
pub const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1;

View File

@ -9,8 +9,8 @@
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2.7.0", "@tauri-apps/api": "^2.7.0",
"@tauri-apps/plugin-deep-link": "^2.4.1", "@tauri-apps/plugin-deep-link": "^2.4.1",
"@tauri-apps/plugin-dialog": "^2.3.2", "@tauri-apps/plugin-dialog": "^2.4.0",
"@tauri-apps/plugin-opener": "^2.4.0", "@tauri-apps/plugin-opener": "^2.5.0",
"@tauri-apps/plugin-os": "^2.3.0", "@tauri-apps/plugin-os": "^2.3.0",
"@tauri-apps/plugin-shell": "^2.3.0", "@tauri-apps/plugin-shell": "^2.3.0",
"pino": "^9.7.0", "pino": "^9.7.0",

2256
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -80,14 +80,13 @@ bytes = "1.10.1"
# Workspaces # Workspaces
client = { version = "0.1.0", path = "../client" } client = { version = "0.1.0", path = "./client" }
database = { path = "../database" } database = { path = "./database" }
process = { path = "../process" } process = { path = "./process" }
remote = { version = "0.1.0", path = "../remote" } remote = { version = "0.1.0", path = "./remote" }
utils = { path = "../utils" } utils = { path = "./utils" }
games = { version = "0.1.0", path = "../games" } games = { version = "0.1.0", path = "./games" }
download_manager = { version = "0.1.0", path = "../download_manager" } download_manager = { version = "0.1.0", path = "./download_manager" }
drop-consts = { version = "0.1.0", path = "../drop-consts" }
[dependencies.dynfmt] [dependencies.dynfmt]
version = "0.1.5" version = "0.1.5"
@ -138,3 +137,18 @@ features = ["derive", "rc"]
lto = true lto = true
codegen-units = 1 codegen-units = 1
panic = 'abort' panic = 'abort'
[workspace]
members = [
"client",
"database",
"process",
"remote",
"utils",
"cloud_saves",
"download_manager",
"games",
]
resolver = "3"

View File

@ -1,12 +1,15 @@
use std::{ use std::{
cell::LazyCell, ffi::OsStr, path::PathBuf, process::{Command, Stdio} ffi::OsStr,
path::PathBuf,
process::{Command, Stdio},
sync::LazyLock,
}; };
use log::info; use log::info;
pub const COMPAT_INFO: LazyCell<Option<CompatInfo>> = LazyCell::new(create_new_compat_info); pub static COMPAT_INFO: LazyLock<Option<CompatInfo>> = LazyLock::new(create_new_compat_info);
pub const UMU_LAUNCHER_EXECUTABLE: LazyCell<Option<PathBuf>> = LazyCell::new(|| { pub static UMU_LAUNCHER_EXECUTABLE: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
let x = get_umu_executable(); let x = get_umu_executable();
info!("{:?}", &x); info!("{:?}", &x);
x x

View File

@ -6,7 +6,6 @@ edition = "2024"
[dependencies] [dependencies]
database = { version = "0.1.0", path = "../database" } database = { version = "0.1.0", path = "../database" }
dirs = "6.0.0" dirs = "6.0.0"
drop-consts = { version = "0.1.0", path = "../drop-consts" }
log = "0.4.28" log = "0.4.28"
regex = "1.11.3" regex = "1.11.3"
rustix = "1.1.2" rustix = "1.1.2"

View File

@ -2,8 +2,7 @@ use std::{collections::HashMap, path::PathBuf, str::FromStr};
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use database::platform::Platform; use database::platform::Platform;
use database::GameVersion; use database::{GameVersion, db::DATA_ROOT_DIR};
use drop_consts::DATA_ROOT_DIR;
use log::warn; use log::warn;
use crate::error::BackupError; use crate::error::BackupError;
@ -28,7 +27,7 @@ impl BackupManager<'_> {
current_platform: Platform::Windows, current_platform: Platform::Windows,
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
current_platform: Platform::MacOs, current_platform: Platform::macOS,
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
current_platform: Platform::Linux, current_platform: Platform::Linux,
@ -44,7 +43,7 @@ impl BackupManager<'_> {
&LinuxBackupManager {} as &(dyn BackupHandler + Sync + Send), &LinuxBackupManager {} as &(dyn BackupHandler + Sync + Send),
), ),
( (
(Platform::MacOs, Platform::MacOs), (Platform::macOS, Platform::macOS),
&MacBackupManager {} as &(dyn BackupHandler + Sync + Send), &MacBackupManager {} as &(dyn BackupHandler + Sync + Send),
), ),
]), ]),

View File

@ -6,7 +6,6 @@ edition = "2024"
[dependencies] [dependencies]
chrono = "0.4.42" chrono = "0.4.42"
dirs = "6.0.0" dirs = "6.0.0"
drop-consts = { version = "0.1.0", path = "../drop-consts" }
log = "0.4.28" log = "0.4.28"
native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"} native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"}
rustbreak = "2.0.0" rustbreak = "2.0.0"

View File

@ -1,5 +1,6 @@
use std::{ use std::{
sync::LazyLock, path::PathBuf,
sync::{Arc, LazyLock},
}; };
use rustbreak::{DeSerError, DeSerializer}; use rustbreak::{DeSerError, DeSerializer};
@ -9,6 +10,19 @@ use crate::interface::{DatabaseImpls, DatabaseInterface};
pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(DatabaseInterface::set_up_database); pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(DatabaseInterface::set_up_database);
#[cfg(not(debug_assertions))]
static DATA_ROOT_PREFIX: &str = "drop";
#[cfg(debug_assertions)]
static DATA_ROOT_PREFIX: &str = "drop-debug";
pub static DATA_ROOT_DIR: LazyLock<Arc<PathBuf>> = LazyLock::new(|| {
Arc::new(
dirs::data_dir()
.expect("Failed to get data dir")
.join(DATA_ROOT_PREFIX),
)
});
// Custom JSON serializer to support everything we need // Custom JSON serializer to support everything we need
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
pub struct DropDatabaseSerializer; pub struct DropDatabaseSerializer;
@ -25,7 +39,7 @@ impl<T: native_model::Model + Serialize + DeserializeOwned> DeSerializer<T>
s.read_to_end(&mut buf) s.read_to_end(&mut buf)
.map_err(|e| rustbreak::error::DeSerError::Other(e.into()))?; .map_err(|e| rustbreak::error::DeSerError::Other(e.into()))?;
let (val, _version) = let (val, _version) =
native_model::decode(buf).map_err(|e| rustbreak::error::DeSerError::Internal(e.to_string()))?; native_model::decode(buf).map_err(|e| DeSerError::Internal(e.to_string()))?;
Ok(val) Ok(val)
} }
} }

View File

@ -7,13 +7,12 @@ use std::{
}; };
use chrono::Utc; use chrono::Utc;
use drop_consts::DATA_ROOT_DIR;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rustbreak::{PathDatabase, RustbreakError}; use rustbreak::{PathDatabase, RustbreakError};
use url::Url; use url::Url;
use crate::{ use crate::{
db::{DB, DropDatabaseSerializer}, db::{DATA_ROOT_DIR, DB, DropDatabaseSerializer},
models::data::Database, models::data::Database,
}; };

View File

@ -4,20 +4,20 @@ use serde::{Deserialize, Serialize};
pub enum Platform { pub enum Platform {
Windows, Windows,
Linux, Linux,
MacOs, macOS,
} }
impl Platform { impl Platform {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub const HOST: Platform = Self::Windows; pub const HOST: Platform = Self::Windows;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub const HOST: Platform = Self::MacOs; pub const HOST: Platform = Self::macOS;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub const HOST: Platform = Self::Linux; pub const HOST: Platform = Self::Linux;
pub fn is_case_sensitive(&self) -> bool { pub fn is_case_sensitive(&self) -> bool {
match self { match self {
Self::Windows | Self::MacOs => false, Self::Windows | Self::macOS => false,
Self::Linux => true, Self::Linux => true,
} }
} }
@ -28,7 +28,7 @@ impl From<&str> for Platform {
match value.to_lowercase().trim() { match value.to_lowercase().trim() {
"windows" => Self::Windows, "windows" => Self::Windows,
"linux" => Self::Linux, "linux" => Self::Linux,
"mac" | "macos" => Self::MacOs, "mac" | "macos" => Self::macOS,
_ => unimplemented!(), _ => unimplemented!(),
} }
} }
@ -39,7 +39,7 @@ impl From<whoami::Platform> for Platform {
match value { match value {
whoami::Platform::Windows => Platform::Windows, whoami::Platform::Windows => Platform::Windows,
whoami::Platform::Linux => Platform::Linux, whoami::Platform::Linux => Platform::Linux,
whoami::Platform::MacOS => Platform::MacOs, whoami::Platform::MacOS => Platform::macOS,
platform => unimplemented!("Playform {} is not supported", platform), platform => unimplemented!("Playform {} is not supported", platform),
} }
} }

View File

@ -24,4 +24,3 @@ throttle_my_fn = "0.2.6"
utils = { version = "0.1.0", path = "../utils" } utils = { version = "0.1.0", path = "../utils" }
native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"} native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"}
serde_json = "1.0.145" serde_json = "1.0.145"
drop-consts = { version = "0.1.0", path = "../drop-consts" }

View File

@ -9,7 +9,6 @@ use download_manager::util::download_thread_control_flag::{
DownloadThreadControl, DownloadThreadControlFlag, DownloadThreadControl, DownloadThreadControlFlag,
}; };
use download_manager::util::progress_object::{ProgressHandle, ProgressObject}; use download_manager::util::progress_object::{ProgressHandle, ProgressObject};
use drop_consts::{MAX_FILES_PER_BUCKET, RETRY_COUNT, TARGET_BUCKET_SIZE};
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rayon::ThreadPoolBuilder; use rayon::ThreadPoolBuilder;
use remote::auth::generate_authorization_header; use remote::auth::generate_authorization_header;
@ -40,6 +39,11 @@ use crate::state::GameStatusManager;
use super::download_logic::download_game_bucket; use super::download_logic::download_game_bucket;
use super::drop_data::DropData; use super::drop_data::DropData;
static RETRY_COUNT: usize = 3;
const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000;
const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1;
pub struct GameDownloadAgent { pub struct GameDownloadAgent {
pub id: String, pub id: String,
pub version: String, pub version: String,

View File

@ -15,7 +15,6 @@ use download_manager::util::download_thread_control_flag::{
DownloadThreadControl, DownloadThreadControlFlag, DownloadThreadControl, DownloadThreadControlFlag,
}; };
use download_manager::util::progress_object::ProgressHandle; use download_manager::util::progress_object::ProgressHandle;
use drop_consts::{BUMP_SIZE, MAX_PACKET_LENGTH};
use log::{debug, info, warn}; use log::{debug, info, warn};
use md5::{Context, Digest}; use md5::{Context, Digest};
use remote::auth::generate_authorization_header; use remote::auth::generate_authorization_header;
@ -26,6 +25,9 @@ use reqwest::blocking::Response;
use crate::downloads::manifest::{ChunkBody, DownloadBucket, DownloadContext, DownloadDrop}; use crate::downloads::manifest::{ChunkBody, DownloadBucket, DownloadContext, DownloadDrop};
static MAX_PACKET_LENGTH: usize = 4096 * 4;
static BUMP_SIZE: usize = 4096 * 16;
pub struct DropWriter<W: Write> { pub struct DropWriter<W: Write> {
hasher: Context, hasher: Context,
destination: BufWriter<W>, destination: BufWriter<W>,

View File

@ -5,13 +5,14 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use drop_consts::DROP_DATA_PATH;
use log::error; use log::error;
use native_model::{Decode, Encode}; use native_model::{Decode, Encode};
use utils::lock; use utils::lock;
pub type DropData = v1::DropData; pub type DropData = v1::DropData;
pub static DROP_DATA_PATH: &str = ".dropdata";
pub mod v1 { pub mod v1 {
use std::{collections::HashMap, path::PathBuf, sync::Mutex}; use std::{collections::HashMap, path::PathBuf, sync::Mutex};

View File

@ -1,11 +1,10 @@
use std::fs; use std::fs;
use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked}; use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked};
use drop_consts::DROP_DATA_PATH;
use log::warn; use log::warn;
use crate::{ use crate::{
downloads::drop_data::DropData, downloads::drop_data::{DROP_DATA_PATH, DropData},
library::set_partially_installed_db, library::set_partially_installed_db,
}; };

View File

@ -7,7 +7,6 @@ edition = "2024"
chrono = "0.4.42" chrono = "0.4.42"
client = { version = "0.1.0", path = "../client" } client = { version = "0.1.0", path = "../client" }
database = { version = "0.1.0", path = "../database" } database = { version = "0.1.0", path = "../database" }
drop-consts = { version = "0.1.0", path = "../drop-consts" }
dynfmt = "0.1.5" dynfmt = "0.1.5"
games = { version = "0.1.0", path = "../games" } games = { version = "0.1.0", path = "../games" }
log = "0.4.28" log = "0.4.28"

View File

@ -12,9 +12,8 @@ use std::{
use database::{ use database::{
ApplicationTransientStatus, Database, DownloadType, DownloadableMetadata, GameDownloadStatus, ApplicationTransientStatus, Database, DownloadType, DownloadableMetadata, GameDownloadStatus,
GameVersion, borrow_db_checked, borrow_db_mut_checked, platform::Platform, GameVersion, borrow_db_checked, borrow_db_mut_checked, db::DATA_ROOT_DIR, platform::Platform,
}; };
use drop_consts::DATA_ROOT_DIR;
use dynfmt::Format; use dynfmt::Format;
use dynfmt::SimpleCurlyFormat; use dynfmt::SimpleCurlyFormat;
use games::{library::push_game_update, state::GameStatusManager}; use games::{library::push_game_update, state::GameStatusManager};
@ -55,7 +54,7 @@ impl ProcessManager<'_> {
current_platform: Platform::Windows, current_platform: Platform::Windows,
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
current_platform: Platform::MacOs, current_platform: Platform::macOS,
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
current_platform: Platform::Linux, current_platform: Platform::Linux,
@ -73,7 +72,7 @@ impl ProcessManager<'_> {
&NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static), &NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static),
), ),
( (
(Platform::MacOs, Platform::MacOs), (Platform::macOS, Platform::macOS),
&NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static), &NativeGameLauncher {} as &(dyn ProcessHandler + Sync + Send + 'static),
), ),
( (

View File

@ -8,7 +8,6 @@ bitcode = "0.6.7"
chrono = "0.4.42" chrono = "0.4.42"
client = { version = "0.1.0", path = "../client" } client = { version = "0.1.0", path = "../client" }
database = { version = "0.1.0", path = "../database" } database = { version = "0.1.0", path = "../database" }
drop-consts = { version = "0.1.0", path = "../drop-consts" }
droplet-rs = "0.7.3" droplet-rs = "0.7.3"
gethostname = "1.0.2" gethostname = "1.0.2"
hex = "0.4.3" hex = "0.4.3"

View File

@ -1,8 +1,10 @@
use std::{ use std::{
fs::{self, File}, io::Read, sync::LazyLock fs::{self, File},
io::Read,
sync::LazyLock,
}; };
use drop_consts::DATA_ROOT_DIR; use database::db::DATA_ROOT_DIR;
use log::{debug, info, warn}; use log::{debug, info, warn};
use reqwest::Certificate; use reqwest::Certificate;
use serde::Deserialize; use serde::Deserialize;

View File

@ -14,7 +14,6 @@ use std::{
use ::client::{app_status::AppStatus, autostart::sync_autostart_on_startup, user::User}; use ::client::{app_status::AppStatus, autostart::sync_autostart_on_startup, user::User};
use ::download_manager::DownloadManagerWrapper; use ::download_manager::DownloadManagerWrapper;
use drop_consts::DATA_ROOT_DIR;
use ::games::{library::Game, scan::scan_install_dirs}; use ::games::{library::Game, scan::scan_install_dirs};
use ::process::ProcessManagerWrapper; use ::process::ProcessManagerWrapper;
use ::remote::{ use ::remote::{
@ -27,7 +26,7 @@ use ::remote::{
utils::DROP_CLIENT_ASYNC, utils::DROP_CLIENT_ASYNC,
}; };
use database::{ use database::{
DB, GameDownloadStatus, borrow_db_checked, borrow_db_mut_checked, DB, GameDownloadStatus, borrow_db_checked, borrow_db_mut_checked, db::DATA_ROOT_DIR,
interface::DatabaseImpls, interface::DatabaseImpls,
}; };
use log::{LevelFilter, debug, info, warn}; use log::{LevelFilter, debug, info, warn};

View File

@ -5,10 +5,9 @@ use std::{
}; };
use database::{ use database::{
Settings, borrow_db_checked, borrow_db_mut_checked, debug::SystemData, Settings, borrow_db_checked, borrow_db_mut_checked, db::DATA_ROOT_DIR, debug::SystemData,
}; };
use download_manager::error::DownloadManagerError; use download_manager::error::DownloadManagerError;
use drop_consts::DATA_ROOT_DIR;
use games::scan::scan_install_dirs; use games::scan::scan_install_dirs;
use log::error; use log::error;
use serde_json::Value; use serde_json::Value;