mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 19:30:27 +03:00
fix(nsis): esitmated size unit (#10086)
* Fix nsis esitmated size unit * Add change file
This commit is contained in:
parent
3bbfac8f3b
commit
58821fc0e5
5
.changes/nsis-esitimated-size-unit.md
Normal file
5
.changes/nsis-esitimated-size-unit.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-bundler": "patch:bug"
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix NSIS esitmated size unit being in kB (1000 bytes) not KB (1024 bytes)
|
@ -661,21 +661,20 @@ fn generate_binaries_data(settings: &Settings) -> crate::Result<BinariesMap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn generate_estimated_size(
|
fn generate_estimated_size(
|
||||||
main: &Path,
|
main: &PathBuf,
|
||||||
binaries: &BinariesMap,
|
binaries: &BinariesMap,
|
||||||
resources: &ResourcesMap,
|
resources: &ResourcesMap,
|
||||||
) -> crate::Result<String> {
|
) -> crate::Result<String> {
|
||||||
use std::fs::metadata;
|
let mut size = 0;
|
||||||
|
for k in std::iter::once(main)
|
||||||
let mut size = metadata(main)?.len();
|
.chain(binaries.keys())
|
||||||
|
.chain(resources.keys())
|
||||||
for k in binaries.keys().chain(resources.keys()) {
|
{
|
||||||
size += metadata(k)?.len();
|
size += std::fs::metadata(k)
|
||||||
|
.with_context(|| format!("when getting size of {}", main.display()))?
|
||||||
|
.len();
|
||||||
}
|
}
|
||||||
|
Ok(format!("{:#08x}", size / 1024))
|
||||||
size /= 1000;
|
|
||||||
|
|
||||||
Ok(format!("{size:#08x}"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_lang_data(lang: &str) -> Option<(String, &[u8])> {
|
fn get_lang_data(lang: &str) -> Option<(String, &[u8])> {
|
||||||
|
Loading…
Reference in New Issue
Block a user