简体   繁体   中英

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) . 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. 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!)

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.

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

I cannot reproduce what you describe.

Changing WizardForm.DirEdit.Text in CurStepChanged(ssInstall) has no effect at all. It's too late.


Anyway, just change the value sooner. For example in the InitializeWizard or CurPageChanged .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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