简体   繁体   English

Inno Setup使用DefaultDirName中的值创建一个不需要的空文件夹

[英]Inno Setup creating an unwanted empty folder with value in DefaultDirName

Inno Setup installer is creating an unwanted empty folder using my initial value of DefaultDirName , even though I have set WizardForm.DirEdit.Text = 'c:\\preferredinstalldir' in CurStepChanged (curStep = ssInstall) . 即使我在CurStepChanged (curStep = ssInstall)设置了WizardForm.DirEdit.Text = 'c:\\preferredinstalldir' ,Inno Setup安装程序也会使用DefaultDirName初始值创建一个不需要的空文件夹。 The installer puts the files in the right installation folder, but because I have to assign a dummy value to DefaultDirName , it creates that dummy folder. 安装程序会将文件放在正确的安装文件夹中,但是由于我必须将一个虚拟值分配给DefaultDirName ,因此它将创建该虚拟文件夹。 I have tried using a {code:xx} function for the DefaultDirName but since the actually folder I want hasn't been determined until the wizard runs, I seem to need a placeholder folder (but I don't want it created!) 我尝试对DefaultDirName使用{code:xx}函数,但是由于直到向导运行时才确定我想要的实际文件夹,所以我似乎需要一个占位符文件夹(但我不想创建它!)

AppId = {code:GetAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppCopyright={#MyAppCopyright}
VersionInfoCopyright={#MyAppCopyright}
AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL}

DefaultDirName={code:GetFilesDestDir}  //this says error path not valid, no root/unc etc etc because the function has no path set yet 
DefaultDirName=c:\mydummyfolder //this creates a dummy folder even though   the files are installed correctly to location i set later in CurStepChanged (I assign WizardForm.DirEdit.Text := InstallPath )

DisableDirPage=yes
DefaultGroupName=SomeName
DisableProgramGroupPage=yes
OutputBaseFilename=mysetup_setup
Compression=lzma
SolidCompression=yes
UsePreviousAppDir=no
UsePreviousLanguage=no
UninstallFilesDir = {code:GetFilesDestDir}\uninst

.............

function GetFilesDestDir(def:string): string;
begin
  if InstallPathSet then
  begin
    Result := InstallPath;
  end
end;

I've seen this question here Inno Script: Strange Empty Folder but it wasn't answered and I couldn't post a comment. 我在这里看到了这个问题:Inno Script:Strange Empty Folder,但是没有得到回答,因此我无法发表评论。

我想我已经找到了解决方案,设置CreateAppDir = no似乎可以解决问题,至少它不再在初始的虚拟位置创建空文件夹。

I cannot reproduce what you describe. 我无法复制您的描述。

Changing WizardForm.DirEdit.Text in CurStepChanged(ssInstall) has no effect at all. CurStepChanged(ssInstall)更改WizardForm.DirEdit.Text完全无效。 It's too late. 太晚了。


Anyway, just change the value sooner. 无论如何,请尽快更改该值。 For example in the InitializeWizard or CurPageChanged . 例如在InitializeWizardCurPageChanged

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

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