【问题标题】:Inno Setup creating an unwanted empty folder with value in DefaultDirNameInno Setup 创建一个不需要的空文件夹,其值为 DefaultDirName
【发布时间】:2015-09-29 13:07:00
【问题描述】:

Inno Setup 安装程序正在使用我的初始值 DefaultDirName 创建一个不需要的空文件夹,即使我在 CurStepChanged (curStep = ssInstall) 中设置了 WizardForm.DirEdit.Text = 'c:\preferredinstalldir'。安装程序将文件放在正确的安装文件夹中,但因为我必须为DefaultDirName 分配一个虚拟值,所以它会创建那个虚拟文件夹。我已经尝试对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;

我在这里看到了这个问题 Inno Script: Strange Empty Folder 但没有得到答复,我无法发表评论。

【问题讨论】:

    标签: installation inno-setup setup-project pascalscript


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我无法重现您所描述的内容。

      CurStepChanged(ssInstall) 中更改WizardForm.DirEdit.Text 完全没有效果。为时已晚。


      无论如何,尽快更改值。例如在InitializeWizardCurPageChanged

      【讨论】:

      • 更改 currStepchanged ssInstall 中的 WizardForm.DirEdit.Text 确实有效果,这就是我根据一些代码选择设置实际安装文件夹的方式。
      • 根据您的 cmets 和自我回答,我猜您没有将文件安装到 {app},而是安装到 {code:GetFilesDestDir}。然后它会像你描述的那样表现。但你没有告诉我们。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-16
      相关资源
      最近更新 更多