Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Templates: the hard-link check covers every Unix, not only Linux

bflatasticced1857637bb
diff --git a/apps/effectcraft-cli/src/template.rs b/apps/effectcraft-cli/src/template.rs
index a4247f2ae..f84303dd0 100644
--- a/apps/effectcraft-cli/src/template.rs
+++ b/apps/effectcraft-cli/src/template.rs
@@ -40,7 +40,7 @@ pub(super) fn validate(cmd: &str, args: &Args) -> Result<(), Failure> {
if path == output {
return true;
}
- #[cfg(target_os = "linux")]
+ #[cfg(unix)]
{
use std::os::unix::fs::MetadataExt;
// Distinct canonical paths can still name the same file through hard links.
diff --git a/apps/effectcraft-cli/tests/qa_template.rs b/apps/effectcraft-cli/tests/qa_template.rs
index ccab23bea..2765b163e 100644
--- a/apps/effectcraft-cli/tests/qa_template.rs
+++ b/apps/effectcraft-cli/tests/qa_template.rs
@@ -654,7 +654,7 @@ fn template_missing_output_does_not_replace_extracted_media() {
let _ = std::fs::remove_dir_all(&dir);
}
-#[cfg(target_os = "linux")]
+#[cfg(unix)]
#[test]
fn template_frame_output_cannot_alias_its_template_through_a_hard_link() {
use std::os::unix::fs::MetadataExt;
@@ -672,7 +672,7 @@ fn template_frame_output_cannot_alias_its_template_through_a_hard_link() {
let _ = std::fs::remove_dir_all(&dir);
}
-#[cfg(target_os = "linux")]
+#[cfg(unix)]
#[test]
fn template_frame_output_cannot_alias_its_values_through_a_hard_link() {
use std::os::unix::fs::MetadataExt;