Compare commits

..

3 Commits

Author SHA1 Message Date
SadlyNotSappho 795462120d update config struct to actually reflect whats in the config file and add psuedocode for the three main functions 2023-07-25 15:31:38 -07:00
SadlyNotSappho 315d3b735e create config file 2023-07-25 15:21:29 -07:00
SadlyNotSappho 81cc929595 remove unused function 2023-07-25 15:16:38 -07:00
2 changed files with 19 additions and 8 deletions

View File

@ -68,15 +68,24 @@ pub fn read_config(file: &String) -> Config {
serde_json::from_str(&read[..]).expect("couldn't parse json") serde_json::from_str(&read[..]).expect("couldn't parse json")
} }
pub fn ensure_exists(path: String) { pub fn unzip(cfg: Config) {
let p = Path::new(&path); // get all files in cfg.archives
if !p.exists() { // unzip them all into cfg.folders
fs::create_dir_all(p).expect("couldn't create folder")
} }
pub fn deploy(cfg: Config) {
// get all folders in cfg.folders
// copy the contents of them into cfg.game_folder
}
pub fn undeploy(cfg: Config) {
// get all folders in cfg.folders
// remove the contents of all of them from cfg.game_folder
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct Config { pub struct Config {
pub latest_date: String, pub archives: String,
pub cache_folder: String, pub folders: String,
pub game_folder: String,
} }

View File

@ -1,4 +1,4 @@
use std::{path::Path, fs::File}; use std::{path::Path, fs::{File, self}};
use clap::Parser; use clap::Parser;
use compress_tools::*; use compress_tools::*;
@ -21,4 +21,6 @@ fn main() {
println!("Config: {}", config_location); println!("Config: {}", config_location);
println!("Steam: {}", steam_location); println!("Steam: {}", steam_location);
cyber_mod_manager::create_config(&format!("{config_location}/CyberModManager/config.json"));
} }