Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Windows: compare exported paths as paths in the same-folder export test

Claude109e4dabd320
diff --git a/crates/engine/src/tests_export.rs b/crates/engine/src/tests_export.rs
index 2f1a05116..e01e7fbd5 100644
--- a/crates/engine/src/tests_export.rs
+++ b/crates/engine/src/tests_export.rs
@@ -991,8 +991,9 @@ fn same_folder_as_original_exports_next_to_each_photo() {
let exists = |p: &str| std::path::Path::new(p).exists();
let files = crate::export::export_batch(&mut s, &ids, &o, &to, &mut crate::export::write_file, &exists).unwrap();
let written: Vec<&str> = files.iter().map(|f| f["path"].as_str().unwrap()).collect();
- let mut want = vec![a.join("Exports/IMG_1.jpg").to_string_lossy().to_string(), b.join("Exports/IMG_1.jpg").to_string_lossy().to_string()];
- let mut got: Vec<String> = written.iter().map(|p| p.to_string()).collect();
+ // compared as paths: on Windows the export joins the subfolder with `/`, which `Path` treats as `\`
+ let mut want = vec![a.join("Exports").join("IMG_1.jpg"), b.join("Exports").join("IMG_1.jpg")];
+ let mut got: Vec<std::path::PathBuf> = written.iter().map(std::path::PathBuf::from).collect();
want.sort();
got.sort();
assert_eq!(got, want);