Skip to content

Commit 4c93f64

Browse files
committed
Improved code readability
1 parent c9ed921 commit 4c93f64

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

ledger_secure_sdk_sys/build.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,21 @@ impl SDKBuilder {
436436
}
437437
}
438438

439-
let mut png_list: Vec<String> = Vec::new();
439+
let mut cmd = Command::new(icon2glyph.as_os_str());
440+
cmd.arg("--glyphcheader")
441+
.arg(dest_path.join("glyphs.h").as_os_str())
442+
.arg("--glyphcfile")
443+
.arg(dest_path.join("glyphs.c").as_os_str());
444+
440445
for folder in glyph_folders.iter() {
441446
for file in std::fs::read_dir(folder).unwrap() {
442447
let path = file.unwrap().path();
443448
let path_str = path.to_str().unwrap().to_string();
444-
png_list.push(path_str);
449+
cmd.arg(path_str);
445450
}
446451
}
447452

448-
let _ = Command::new(icon2glyph.as_os_str())
449-
.arg("--glyphcheader")
450-
.arg(dest_path.join("glyphs.h").as_os_str())
451-
.arg("--glyphcfile")
452-
.arg(dest_path.join("glyphs.c").as_os_str())
453-
.args(png_list)
454-
.output();
453+
let _ = cmd.output();
455454
}
456455

457456
pub fn build_c_sdk(&self) {
@@ -589,17 +588,14 @@ impl SDKBuilder {
589588
}
590589
Device::Stax | Device::Flex => {
591590
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
592-
if Device::Stax == self.device {
593-
let glyphs = out_path.join("glyphs_stax");
594-
let include_path = glyphs.to_str().unwrap();
595-
let s = "-I".to_string() + include_path;
596-
bindings = bindings.clang_args([s.as_str()]);
597-
} else {
598-
let glyphs = out_path.join("glyphs_flex");
599-
let include_path = glyphs.to_str().unwrap();
600-
let s = "-I".to_string() + include_path;
601-
bindings = bindings.clang_args([s.as_str()]);
602-
}
591+
let mut include_path = "-I".to_string();
592+
let glyphs = match self.device {
593+
Device::Stax => out_path.join("glyphs_stax"),
594+
Device::Flex => out_path.join("glyphs_flex"),
595+
_ => panic!("Invalid device"),
596+
};
597+
include_path += glyphs.to_str().unwrap();
598+
bindings = bindings.clang_args([include_path.as_str()]);
603599

604600
bindings = bindings.clang_args([
605601
format!("-I{bsdk}/lib_nbgl/include/").as_str(),

0 commit comments

Comments
 (0)