Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

klad builds on Windows: two unix-only calls are guarded

Indicode BVa4c3eb4e7f7e
diff --git a/crates/app/src/composite.rs b/crates/app/src/composite.rs
index 2b925c7..c8cd377 100644
--- a/crates/app/src/composite.rs
+++ b/crates/app/src/composite.rs
@@ -78,15 +78,31 @@ struct Stamp {
}
fn stamp(path: &Path) -> Option<Stamp> {
- use std::os::unix::fs::MetadataExt;
let meta = fs::metadata(path).ok()?;
Some(Stamp {
len: meta.len(),
modified: meta.modified().ok(),
- inode: meta.ino(),
+ inode: inode(&meta),
})
}
+#[cfg(unix)]
+fn inode(meta: &fs::Metadata) -> u64 {
+ use std::os::unix::fs::MetadataExt;
+ meta.ino()
+}
+
+#[cfg(windows)]
+fn inode(meta: &fs::Metadata) -> u64 {
+ use std::os::windows::fs::MetadataExt;
+ meta.creation_time()
+}
+
+#[cfg(not(any(unix, windows)))]
+fn inode(_meta: &fs::Metadata) -> u64 {
+ 0
+}
+
pub struct CelData {
pub replay: CelReplay,
file_hash: u64,
diff --git a/crates/render/build.rs b/crates/render/build.rs
index 2e51795..5393305 100644
--- a/crates/render/build.rs
+++ b/crates/render/build.rs
@@ -26,5 +26,15 @@ fn link_runtime_only(system: &Path, out: &Path, name: &str, major: &str) -> bool
}
let link = out.join(format!("lib{name}.so"));
let _ = std::fs::remove_file(&link);
- std::os::unix::fs::symlink(&runtime, &link).is_ok()
+ symlink(&runtime, &link)
+}
+
+#[cfg(unix)]
+fn symlink(from: &Path, to: &Path) -> bool {
+ std::os::unix::fs::symlink(from, to).is_ok()
+}
+
+#[cfg(not(unix))]
+fn symlink(_from: &Path, _to: &Path) -> bool {
+ false
}