Skip to content

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

Windows: desktop entry paths, toolchain lints

OneSlips6c79be913033
diff --git a/apps/lightcraft/src/editors.rs b/apps/lightcraft/src/editors.rs
index 9a8cc22d2..8b99e284d 100644
--- a/apps/lightcraft/src/editors.rs
+++ b/apps/lightcraft/src/editors.rs
@@ -172,8 +172,10 @@ fn desktop_exec(entry: &str) -> Option<PathBuf> {
Some(rest) => rest.split('"').next()?,
None => exec.split_whitespace().next()?,
};
- // a bare name (`photocraft %F`) was already looked for on the PATH
- Some(PathBuf::from(program)).filter(|p| p.is_absolute())
+ // a bare name (`photocraft %F`) was already looked for on the PATH. Desktop entries are a
+ // freedesktop (POSIX) format: absolute means a leading `/` on every platform the parser runs on
+ // (`Path::is_absolute` wants a drive letter on Windows, where the tests run too)
+ program.starts_with('/').then(|| PathBuf::from(program))
}
#[cfg(test)]
diff --git a/crates/catalog/src/lock.rs b/crates/catalog/src/lock.rs
index 8a2b496d6..d699da049 100644
--- a/crates/catalog/src/lock.rs
+++ b/crates/catalog/src/lock.rs
@@ -135,8 +135,9 @@ impl LibraryLock {
}
/// Another descriptor on the locked file: what a process spawned by another thread holds
- /// between fork and exec (a `dup` refers to the same open file description). Tests only.
- #[cfg(test)]
+ /// between fork and exec (a `dup` refers to the same open file description). Tests only (the
+ /// test that uses it is Unix-only: `flock` semantics).
+ #[cfg(all(test, unix))]
pub(crate) fn descriptor_copy(&self) -> Option<File> {
self.file.as_ref().and_then(|f| f.try_clone().ok())
}
diff --git a/crates/pipeline/src/spots.rs b/crates/pipeline/src/spots.rs
index 483f83f3c..32f55a3c7 100644
--- a/crates/pipeline/src/spots.rs
+++ b/crates/pipeline/src/spots.rs
@@ -247,7 +247,7 @@ fn fill_box(src: &mut [[f32; 3]], tgt: &[[f32; 3]], alpha: &[f32], bw: usize, bh
let flat: Vec<f32> = tgt.iter().flatten().copied().collect();
let out = lightcraft_inpaint::complete(bw, bh, 3, &flat, &hole, &lightcraft_inpaint::CompleteParams::default())
.unwrap_or_else(|| lightcraft_inpaint::membrane_fill(bw, bh, 3, &flat, &hole));
- for (d, v) in src.iter_mut().zip(out.chunks_exact(3)) {
+ for (d, v) in src.iter_mut().zip(out.as_chunks::<3>().0) {
*d = [v[0], v[1], v[2]];
}
}