简体   繁体   English

MUI_PAGE_DIRECTORY 所需空间为 0.0KB

[英]Space required on MUI_PAGE_DIRECTORY is 0.0KB

I'm writing an installer for Windows application.我正在为 Windows 应用程序编写安装程序。 I'm using MUI for NSIS.我正在为 NSIS 使用 MUI。 One of the pages of the installer is Directory Page, where I have the "Space required" field.安装程序的页面之一是目录页面,其中我有“所需空间”字段。 The problem is that the space required is always 0.0KB.问题是所需的空间总是 0.0KB。

I was looking for some answers, but all I found was that space is calculated automatically.我一直在寻找一些答案,但我发现的只是空间是自动计算的。 I wonder if there is some way to check which folder size this macro gets?我想知道是否有某种方法可以检查该宏获得的文件夹大小? Or any other ideas?还是有其他想法?

;Pages

; Installation
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE                "@CPACK_RESOURCE_FILE_LICENSE@"
!insertmacro MUI_PAGE_DIRECTORY
Page custom pgAppLanguageCreate

The size is automatically calculated by the File instructions in Section s plus any extra you add with AddSize .大小由Section sFile指令以及您使用AddSize添加的任何额外内容自动计算。

If you are not happy with this calculation you can force a specific size in .onInit with SectionSetSize .如果您对此计算不满意,可以使用SectionSetSize.onInit中强制指定特定大小。

I found what causes the problem.我找到了导致问题的原因。 In the "Installer Section" I used a function that copies all files.在“安装程序部分”中,我使用了复制所有文件的 function。 Instead of calling it here, I just paste the entire function and now that works.我没有在这里调用它,而是粘贴整个 function,现在可以了。 It looks like you cant use "File" instruction in function because it doesn't add size to the required space this way.看起来您不能在 function 中使用“文件”指令,因为它不会以这种方式增加所需空间的大小。 If you use it in section, it works perfectly.如果您在部分中使用它,它会完美运行。

; Installer Sections     
Section "install" Install 

    ${If} $instState != "1"
        Call deleteAllFiles
        Call deleteInfoFromRegistry
        Call deleteShortcut
    ${EndIf}


    SetOutPath "$INSTDIR"

    ; copy files
    File ${ICON}
    File "slicer_license"
    File /r "${INSTALL_FILE}\package\"
    ;File "README.txt" ;Readme file.
    Call createShortcut
    Call addInfoToRegistry
    Call setAppLanguageShortcut
    Call createLanguageFile

SectionEnd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM