clone the programs to a tmp directory. avoid to edit the raw programs.
(&self)
| 87 | // clone the programs to a tmp directory. |
| 88 | // avoid to edit the raw programs. |
| 89 | fn clone_programs(&self) -> Result<Vec<PathBuf>> { |
| 90 | let mut new_programs = Vec::new(); |
| 91 | |
| 92 | let tmp_dir = self.deopt.get_library_driver_dir()?; |
| 93 | for (id, program) in self.programs.iter().enumerate() { |
| 94 | let mut dst_path = tmp_dir.clone(); |
| 95 | dst_path.push(format!("id_{number:>0width$}.cc", number = id, width = 6)); |
| 96 | std::fs::copy(program, &dst_path) |
| 97 | .context(format!("Unable to copy {program:?} to {dst_path:?}"))?; |
| 98 | new_programs.push(dst_path); |
| 99 | } |
| 100 | Ok(new_programs) |
| 101 | } |
| 102 | |
| 103 | pub fn transform(&mut self) -> Result<()> { |
| 104 | self.init()?; |
no test coverage detected