summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ro/rollup/src
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ro/rollup/src')
-rw-r--r--pkgs/by-name/ro/rollup/src/main.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/pkgs/by-name/ro/rollup/src/main.rs b/pkgs/by-name/ro/rollup/src/main.rs
index 08f18648..29746e07 100644
--- a/pkgs/by-name/ro/rollup/src/main.rs
+++ b/pkgs/by-name/ro/rollup/src/main.rs
@@ -144,18 +144,38 @@ fn main() -> Result<()> {
return Ok(());
};
let patch_files = {
+ let iter = fs::read_dir(&patches_directory)?;
+ let mut output = vec![None; iter.count()];
+
let iter = fs::read_dir(patches_directory)?;
- let mut output = vec![];
for entry in iter {
let entry = entry?;
if !entry.file_type()?.is_file() {
unreachable!("Should not be able to get non-files in patches directory");
}
- output.push(entry.path());
+ let path = entry.path();
+ let idx: usize = {
+ let mut file_name = path
+ .file_name()
+ .expect("Should all have a filename")
+ .to_str()
+ .expect("Should be valid utf8")
+ .chars();
+ let number = file_name.clone().take(4).collect::<String>();
+ assert_eq!(file_name.nth(4), Some('-'));
+
+ number.parse().expect("Should parse as usize number")
+ };
+ output[idx - 1] = Some(path);
}
+ output.sort();
output
};
- apply_patches(patch_files, to, debug_parse)?;
+ apply_patches(
+ patch_files.into_iter().map(|s| s.unwrap()).collect(),
+ to,
+ debug_parse,
+ )?;
}
}