enhance(nsis): include uninstaller size in estimated size (#10137)

This commit is contained in:
Amr Bashir 2024-06-27 15:43:13 +03:00 committed by GitHub
parent e93ca1df3b
commit 77d44215ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -673,17 +673,17 @@ fn generate_estimated_size(
main: &PathBuf,
binaries: &BinariesMap,
resources: &ResourcesMap,
) -> crate::Result<String> {
) -> crate::Result<u64> {
let mut size = 0;
for k in std::iter::once(main)
.chain(binaries.keys())
.chain(resources.keys())
{
size += std::fs::metadata(k)
.with_context(|| format!("when getting size of {}", main.display()))?
.with_context(|| format!("when getting size of {}", k.display()))?
.len();
}
Ok(format!("{:#08x}", size / 1024))
Ok(size / 1024)
}
fn get_lang_data(lang: &str) -> Option<(String, &[u8])> {

View File

@ -614,7 +614,12 @@ Section Install
WriteRegStr SHCTX "${UNINSTKEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoModify" "1"
WriteRegDWORD SHCTX "${UNINSTKEY}" "NoRepair" "1"
WriteRegDWORD SHCTX "${UNINSTKEY}" "EstimatedSize" "${ESTIMATEDSIZE}"
${GetSize} "$INSTDIR" "/M=uninstall.exe /S=0K /G=0" $0 $1 $2
IntOp $0 $0 + ${ESTIMATEDSIZE}
IntFmt $0 "0x%08X" $0
WriteRegDWORD SHCTX "${UNINSTKEY}" "EstimatedSize" "$0"
!if "${HOMEPAGE}" != ""
WriteRegStr SHCTX "${UNINSTKEY}" "URLInfoAbout" "${HOMEPAGE}"
WriteRegStr SHCTX "${UNINSTKEY}" "URLUpdateInfo" "${HOMEPAGE}"