W73N4XA3BEOLWWSYSQ3CL6KCEAQAEPJJCHSZIUNWCWL2TLRVWLKQC pub const CONFIG_EXAMPLE: &str = "project_dir_name: \"projects\",project_dir_location: \"/home/aviik/Dev/\"user: \"aviik\"";
const CONFIG: &str = "// Some of the fields if altered could cause the program to not work properly(user: None, // Add: Remove None and Some(<user>) eg. Some<\"aviik\")use_onedrive: false // Use OneDrive for backupproj_dir: VFxProjects(project_dir: None, // Add: Remove None and Some(<directory>) eg. Some<\"D:\\\"),dir_name: None, // Add: Remove None and Some(<directory name>) eg. Some<\"projects\"),),proj_map: {1: \"cmp\",2: \"docs\",3: \"edit\",4: \"assets\",5: \"footage\",6: \"test\",},)";
// dbg!("Checking Confifuration!");
pub fn get_default_path() -> Option<PathBuf> {//In windows "C:\\Users\\<user>\\AppData\\Roaming\\vfxpr\\config.ron"//In linux /home/<user>/.config/vfxpr/config.ron//MacOs $HOME/Library/Application Support/vfxpr/config.ronif let Some(c_path) = dirs::config_dir() {let mut file_path = std::path::PathBuf::new();file_path.push(c_path);file_path.push(VFXPRNAME);file_path.push(VFXPRCONFIGFILENAME);Some(file_path)}None}
fn config_file_path_output() -> Result<String, errors::VFxProjectError> {if cfg!(target_os = "windows") {Ok("~\\AppData\\Roaming\\felix\\config.yaml".to_owned())} else {Ok("making config".to_owned())//Ok(config_file_path()?.to_str().unwrap().to_owned())}
fn write_config_to_drive() {// if let Some(os_config_dir) = dirs::config_dir {}let config: Config = match from_str(CONFIG) {Ok(x) => x,Err(e) => {println!("Failed to load config: {}", e);std::process::exit(1);}};let pretty = PrettyConfig::new().depth_limit(2);// .separate_tuple_members(true)// .enumerate_arrays(true);let s = to_string_pretty(&config, pretty).expect("Serialization failed");
fn get_os () {if cfg(target_os="unix") {println!("Found linux");//"linux" => println!("Found linux"),//"windows" => println!("Found windows"),//_ => println!("sdsdsd")}
pub fn read_config_from_drive(input_path: &Path) {let f = File::open(&input_path).expect("Failed opening file");let config: Config = match from_reader(f) {Ok(x) => x,Err(e) => {println!("Failed to load config: {}", e);std::process::exit(1);}};
// fn config_file_path_output() -> Result<String, errors::VFxProjectError> {// if cfg!(target_os = "windows") {// Ok("~\\AppData\\Roaming\\felix\\config.yaml".to_owned())// } else {// Ok("making config".to_owned())// //Ok(config_file_path()?.to_str().unwrap().to_owned())// }// }
[package]name = "vfxpr_core"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[dependencies]dirs = "4.0.0"ron = { version = "0.8.0", features = ["indexmap"] }serde = { version = "1.0.152", features = ["derive"] }
if let Some(config_p) = cli.config.as_deref() {let y: &str = config_p.as_os_str().to_str().unwrap_or_default();config_path = cli::config::VFxPRConfigFile::new(y);recieved_config = true;println!("Recieved user config");// println!("user config file path: {:?}", config_path);// println!("Value for config: {:?}", config_path.display());
if !recieved_config {if let Some(config_p) = cli.config.as_deref() {let y: &str = config_p.as_os_str().to_str().unwrap_or_default();config_path = cli::config::VFxPRConfigFile::new(y);recieved_config = true;println!("Recieved user config");// println!("user config file path: {:?}", config_path);// println!("Value for config: {:?}", config_path.display());}