Skip to content

A treemap for finding and removing what fills your disk, for Omarchy. Rust + GPUI.

Rust

fix(windows): satisfy icon build lint

rteoo358e4104bbc4
diff --git a/crates/disktree-app/build.rs b/crates/disktree-app/build.rs
index cb46147..b3e6868 100644
--- a/crates/disktree-app/build.rs
+++ b/crates/disktree-app/build.rs
@@ -17,37 +17,45 @@ fn main() {
// Cargo can run outside a Visual Studio prompt, where the SDK bin is not
// on PATH even though the MSVC linker and Windows SDK are installed.
- let rc_exe = env::var_os("DISKTREE_RC").map(PathBuf::from).unwrap_or_else(|| {
- let sdk_bin = env::var_os("WindowsSdkDir")
- .map(PathBuf::from)
- .or_else(|| {
- env::var_os("ProgramFiles(x86)")
- .map(|root| PathBuf::from(root).join("Windows Kits/10"))
- })
- .expect("Windows SDK is required to embed the icon")
- .join("bin");
- let host = match env::consts::ARCH {
- "x86_64" => "x64",
- "aarch64" => "arm64",
- "x86" => "x86",
- other => panic!("unsupported Windows build host: {other}"),
- };
- let mut versions: Vec<_> = fs::read_dir(&sdk_bin)
- .expect("Windows SDK bin directory is missing")
- .filter_map(Result::ok)
- .map(|entry| entry.path().join(host).join("rc.exe"))
- .filter(|path| path.is_file())
- .collect();
- versions.sort();
- versions.pop().expect("rc.exe is missing from the Windows SDK")
- });
+ let rc_exe = env::var_os("DISKTREE_RC").map_or_else(
+ || {
+ let sdk_bin = env::var_os("WindowsSdkDir")
+ .map(PathBuf::from)
+ .or_else(|| {
+ env::var_os("ProgramFiles(x86)")
+ .map(|root| PathBuf::from(root).join("Windows Kits/10"))
+ })
+ .expect("Windows SDK is required to embed the icon")
+ .join("bin");
+ let host = match env::consts::ARCH {
+ "x86_64" => "x64",
+ "aarch64" => "arm64",
+ "x86" => "x86",
+ other => panic!("unsupported Windows build host: {other}"),
+ };
+ let mut versions: Vec<_> = fs::read_dir(&sdk_bin)
+ .expect("Windows SDK bin directory is missing")
+ .filter_map(Result::ok)
+ .map(|entry| entry.path().join(host).join("rc.exe"))
+ .filter(|path| path.is_file())
+ .collect();
+ versions.sort();
+ versions
+ .pop()
+ .expect("rc.exe is missing from the Windows SDK")
+ },
+ PathBuf::from,
+ );
let status = Command::new(rc_exe)
.arg("/nologo")
.arg(format!("/fo{}", res.display()))
.arg(&rc)
.status()
.expect("could not start rc.exe to embed the Windows icon");
- assert!(status.success(), "rc.exe failed to compile the Windows icon");
+ assert!(
+ status.success(),
+ "rc.exe failed to compile the Windows icon"
+ );
println!("cargo:rerun-if-changed={}", icon.display());
println!("cargo:rustc-link-arg-bin=disktree={}", res.display());