Skip to content

An open-source cross-platform alternative to AirDrop

feat: add VERSIONINFO to cli exe

Tien Do Nam5de77f4955ed
diff --git a/Cargo.lock b/Cargo.lock
index 4a566094..ac69b1ce 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2256,6 +2256,7 @@ dependencies = [
"toml",
"unicode-width",
"uuid",
+ "winresource",
]
[[package]]
@@ -5179,6 +5180,16 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
+[[package]]
+name = "winresource"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087"
+dependencies = [
+ "toml",
+ "version_check",
+]
+
[[package]]
name = "wit-bindgen"
version = "0.57.1"
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 7c11c70b..4c9d9367 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -30,3 +30,6 @@ tokio-util = { version = "0.7", features = ["rt"] }
toml = "1.1"
unicode-width = "0.2"
uuid = { version = "1", features = ["v4"] }
+
+[build-dependencies]
+winresource = "0.1"
diff --git a/cli/build.rs b/cli/build.rs
new file mode 100644
index 00000000..9104606b
--- /dev/null
+++ b/cli/build.rs
@@ -0,0 +1,15 @@
+fn main() {
+ // VERSIONINFO metadata for the Windows exe, mirroring app/windows/runner/Runner.rc.
+ // SignPath requires ProductName/ProductVersion on all signed binaries.
+ if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
+ let mut res = winresource::WindowsResource::new();
+ res.set("ProductName", "LocalSend");
+ res.set("FileDescription", "LocalSend CLI");
+ res.set("CompanyName", "Tien Do Nam");
+ res.set("OriginalFilename", "localsend-cli.exe");
+ res.set("InternalName", "localsend-cli");
+ res.set("LegalCopyright", "Copyright (C) 2022-2026 Tien Do Nam. All rights reserved.");
+ // FileVersion/ProductVersion are derived from CARGO_PKG_VERSION automatically.
+ res.compile().expect("failed to compile Windows resources");
+ }
+}
\ No newline at end of file