Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.
Rust desktop-appdiscorddiscord-clienteguielectron-alternativelightweightlinuxmacosnative-apprustwindows
//! rustcord-pack.exe: a build step, not something to ship. It compresses the
//! release rustcord.exe and the uninstaller (next to itself, in
//! target\release) into the .gz files the installer carries; that makes the
//! installer less than half the size. build-installer.cmd runs it.
use std::io::Write;
fn main() {
let dir = std::env::current_exe().ok().and_then(|p| p.parent().map(|d| d.to_path_buf())).expect("can't find the packer's folder");
for name in ["rustcord.exe", "rustcord-uninstall.exe"] {
let source = dir.join(name);
let bytes = std::fs::read(&source).unwrap_or_else(|e| panic!("can't read {}: {e}", source.display()));
let mut gz = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::best());
gz.write_all(&bytes).expect("compressing");
let packed = gz.finish().expect("compressing");
let target = dir.join(format!("{name}.gz"));
std::fs::write(&target, &packed).unwrap_or_else(|e| panic!("can't write {}: {e}", target.display()));
println!("{name}: {:.1} MB -> {:.1} MB", bytes.len() as f64 / 1048576.0, packed.len() as f64 / 1048576.0);
}
}