mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-01-30 19:15:17 +01:00
* feat: depot api downloads * feat: frontend fixes and experimental webview store * feat: sync downloader * feat: cleanup and fixes * feat: encrypted database and fixed resuming * feat: launch option selector * fix: autostart when no options * fix: clippy * fix: clippy x2 * feat: executor launch * feat: executor launch * feat: not installed error handling * feat: better offline handling * feat: dependency popup * fix: cancelation and resuming issues * feat: dedup by platform * feat: new ui for additional components and fix dl manager clog * feat: auto-queue dependencies * feat: depot scanning and ranking * feat: new library fetching stack * In-app store page (Windows + macOS) (#176) * feat: async store loading * feat: fix overscroll behaviour * fix: query params in server protocol * fix: clippy
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
use std::fs;
|
|
|
|
use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked};
|
|
use log::warn;
|
|
|
|
use crate::{
|
|
downloads::drop_data::{DROPDATA_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(DROPDATA_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,
|
|
drop_data.game_version,
|
|
drop_data.target_platform,
|
|
DownloadType::Game,
|
|
);
|
|
set_partially_installed_db(
|
|
&mut db_lock,
|
|
&metadata,
|
|
drop_data.base_path.to_str().unwrap().to_string(),
|
|
None,
|
|
);
|
|
}
|
|
}
|
|
}
|