Squashed commit of the following:

commit 3b09dcfb73
Author: quexeky <git@quexeky.dev>
Date:   Mon Oct 13 08:10:52 2025 +1100

    fix: #159

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

commit 2859a59622
Author: quexeky <git@quexeky.dev>
Date:   Mon Oct 13 08:03:49 2025 +1100

    Squashed commit of the following:

    commit 0f48f3fb44
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 19:35:04 2025 +1100

        chore: Run cargo clippy && cargo fmt

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

    commit 974666efe2
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 19:17:40 2025 +1100

        refactor: Finish refactor

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

    commit 9e1bf9852f
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 18:33:43 2025 +1100

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

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

    commit 5d22b883d5
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 17:04:27 2025 +1100

        refactor: Improvements to src-tauri

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

    commit 62a2561539
    Author: quexeky <git@quexeky.dev>
    Date:   Sat Oct 11 09:51:04 2025 +1100

        fix: Remote tauri dependency from process

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

    commit 59f040bc8b
    Author: quexeky <git@quexeky.dev>
    Date:   Thu Oct 9 07:46:17 2025 +1100

        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>

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

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2025-10-13 08:21:27 +11:00
parent cc57ca7076
commit ef9f8caa54
111 changed files with 15706 additions and 1995 deletions

47
games/src/scan.rs Normal file
View File

@ -0,0 +1,47 @@
use std::fs;
use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked};
use log::warn;
use crate::{
downloads::drop_data::{DROP_DATA_PATH, DropData},
library::set_partially_installed_db,
};
pub fn scan_install_dirs() {
let mut db_lock = borrow_db_mut_checked();
for install_dir in db_lock.applications.install_dirs.clone() {
let Ok(files) = fs::read_dir(install_dir) else {
continue;
};
for game in files.into_iter().flatten() {
let drop_data_file = game.path().join(DROP_DATA_PATH);
if !drop_data_file.exists() {
continue;
}
let game_id = game.file_name().display().to_string();
let Ok(drop_data) = DropData::read(&game.path()) else {
warn!(
".dropdata exists for {}, but couldn't read it. is it corrupted?",
game.file_name().display()
);
continue;
};
if db_lock.applications.game_statuses.contains_key(&game_id) {
continue;
}
let metadata = DownloadableMetadata::new(
drop_data.game_id,
Some(drop_data.game_version),
DownloadType::Game,
);
set_partially_installed_db(
&mut db_lock,
&metadata,
drop_data.base_path.to_str().unwrap().to_string(),
None,
);
}
}
}