S2WRTBWXV772ILZMBKL37XTVJ2MDTXY7R6WYLKWSVR6OZBF6ZAZAC mod errors;mod config;pub fn add(left: usize, right: usize) -> usize {left + right}#[cfg(test)]mod tests {use super::*;#[test]fn it_works() {let result = add(2, 2);assert_eq!(result, 4);}}
#[derive(Debug)]pub enum VFxProjectError {IOError(String),VFxProjectNameError,VFxShotNameError,}impl std::error::Error for VFxProjectError{}impl std::fmt::Display for VFxProjectError {fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {let printable = match self {VFxProjectError::IOError(s) => s.to_owned(),VFxProjectError::VFxProjectNameError => "Bad Project Name".to_owned(),VFxProjectError::VFxShotNameError => "Bad Shot Name".to_owned(),};write!(f, "{}", printable)}}impl From<std::io::Error> for VFxProjectError {fn from(err: std::io::Error) -> Self {VFxProjectError::IOError(err.to_string())}}
//Create config file//Parse config file//look for config fileuse super::errors;use serde::{Serialize, Deserialize};pub const CONFIG_FILE: &str = "vfx_config.ron";pub const CONFIG_EXAMPLE: &str = "project_dir_name: \"projects\",project_dir_location: \"/home/aviik/Dev/\"user: \"aviik\"";// dbg!("Checking Confifuration!");#[derive(Debug, Deserialize, Serialize)]struct MyStruct {boolean: bool,float: f32,}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 get_os () {if cfg(target_os="unix") {println!("Found linux");//"linux" => println!("Found linux"),//"windows" => println!("Found windows"),//_ => println!("sdsdsd")}}
let y: &str = user_config_path.as_os_str().to_str().unwrap_or_default();let config = cli::config::VFxPRConfigFile::new(y);println!("user config file path: {}", config);} else {if let Some(config_path) = cli.config.as_deref() {let y: &str = config_path.as_os_str().to_str().unwrap_or_default();let config = cli::config::VFxPRConfigFile::new(y);println!("user config file path: {}", config);
let y: &str = user_config_path.as_os_str().to_str().expect("expected something");config_path = cli::config::VFxPRConfigFile::new(y);recieved_config = true;println!("Recieved user config");// println!("user config file path: {:?}", config_path);}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);
Self {config_path: Some(PathBuf::from(s)),config_type: VFxPRConfigType::Sourced,
if PathBuf::from(s).is_file() {Self {config_path: Some(PathBuf::from(s)),config_type: VFxPRConfigType::Sourced,}} else {Self {config_path: None,..Default::default()}
fn get_default_config() -> Option<PathBuf> {let c_path = dirs::config_dir()?;let mut file_path = std::path::PathBuf::new();file_path.push(c_path);file_path.push(constants::VFXPRNAME);file_path.push(constants::VFXPRCONFIGFILENAME);println!("Seeking file at: {:?}", file_path);
// }}fn get_default_path() -> PathBuf {if let Some(c_path) = dirs::config_dir() {let mut file_path = std::path::PathBuf::new();file_path.push(c_path);file_path.push(constants::VFXPRNAME);file_path.push(constants::VFXPRCONFIGFILENAME);file_path} else {PathBuf::new()}}fn get_default_config() -> Option<VFxPRConfigFile> {let file_path = get_default_path();
pub fn create_config_file() -> bool {// let file_path = get_default_path();false}