mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 15:27:48 +00:00
create cache module
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use crate::misc;
|
||||
use crate::structs::{PrintPrefix, StoredGameData};
|
||||
use crate::structs::PrintPrefix;
|
||||
use colored::Colorize;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashMap;
|
||||
@@ -66,17 +65,3 @@ pub async fn check_connectivity() -> bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_stored_data() -> Option<StoredGameData> {
|
||||
let dir = std::env::current_dir().ok()?;
|
||||
let cache = misc::get_cache(&dir);
|
||||
cache.stored_data
|
||||
}
|
||||
|
||||
pub fn store_game_data(data: &StoredGameData) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let dir = std::env::current_dir()?;
|
||||
let mut cache = misc::get_cache(&dir);
|
||||
cache.stored_data = Some((*data).clone());
|
||||
misc::save_cache(&dir, cache);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user