Returns the output directory for one workload after validating that it cannot escape root.
(root: &Path, workload: &str)
| 628 | |
| 629 | /// Returns the output directory for one workload after validating that it cannot escape root. |
| 630 | pub fn workload_output_dir(root: &Path, workload: &str) -> Result<PathBuf> { |
| 631 | eyre::ensure!( |
| 632 | !workload.is_empty() |
| 633 | && workload != "." |
| 634 | && workload != ".." |
| 635 | && !workload.contains('/') |
| 636 | && !workload.contains('\\'), |
| 637 | "workload must be a single directory name: {workload:?}" |
| 638 | ); |
| 639 | Ok(root.join(workload)) |
| 640 | } |
| 641 | |
| 642 | /// Writes one JSON artifact and ensures its parent directory exists. |
| 643 | pub fn write_json<T: Serialize>(path: &Path, value: &T, artifact: &str) -> Result<()> { |
nothing calls this directly
no outgoing calls
no test coverage detected