diff --git a/igloo_core/src/igloo_target.rs b/igloo_core/src/igloo_target.rs index 5b965e8..c3f74d4 100644 --- a/igloo_core/src/igloo_target.rs +++ b/igloo_core/src/igloo_target.rs @@ -154,6 +154,28 @@ impl IglooTarget return ret } } + + } + + if !self.root.join("scripts").exists() + { + // make scripts dir + match std::fs::create_dir(&self.root.join("scripts")) + { + Ok(_v) => (), + Err(e) => + { + ret = IS_FAILED_TO_CREATE_DIR; + igloo_debug!(ERROR, ret, "Failed to create {} -- {}", self.root.join("scripts").to_str().unwrap(), e); + return ret + } + } + } + + ret = self.gather_esf_gdb_scripts(project); + if ret != IS_GOOD + { + return ret } ret = self.generate_makefile(project); @@ -946,6 +968,46 @@ endif\n").unwrap(); } ret } + + + fn gather_esf_gdb_scripts(&self, project: &IglooProject) -> IglooStatus + { + let mut ret = IS_GOOD; + let target_scripts_dir = self.root.join("scripts"); + for _script in &self.config.scripts + { + // Making so many vars here for + // 1.) readability and + // 2.) to prevent "temporary value dropped while borrowed" ?? + let absolute_script_path = std::path::PathBuf::from(&_script); + let file_name = absolute_script_path.file_name().unwrap(); + let from_path = std::path::PathBuf::from(project.igloo.env.esfd.join(&_script)); + let to_path = std::path::PathBuf::from(target_scripts_dir.join(&file_name)); + match std::os::unix::fs::symlink(&from_path, &to_path) + { + Ok(_v) => (), + Err(e) => + { + ret = IS_FAILED_TO_CREATE_SYMLINK; + igloo_debug!(ERROR, + ret, + "Failed to create symlink from {} to {} -- Error: {}", + &from_path.to_str().unwrap(), + &to_path.to_str().unwrap(), + e); + return ret + } + } + } + ret + } + + fn gather_esf_inc_files(&self, project: &IglooProject) -> IglooStatus + { + let mut ret = IS_GOOD; + + ret + } pub fn collect_makefile(&mut self, project: &IglooProject) -> IglooStatus { let mut ret: IglooStatus = IS_GOOD; diff --git a/igloo_util/src/lib.rs b/igloo_util/src/lib.rs index 31576a1..c274a02 100644 --- a/igloo_util/src/lib.rs +++ b/igloo_util/src/lib.rs @@ -62,6 +62,7 @@ pub enum IglooStatus IS_FAILED_TO_CREATE_DIR = 0x07, IS_FAILED_TO_EXTRACT_MF_VAR = 0x08, IS_FAILED_TO_WRITE_MF_VAR = 0x09, + IS_FAILED_TO_CREATE_SYMLINK = 0x0A, IS_NONE = 0xFF, }