-1

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.

Community
  • 1
  • 1

2 Answers2

1

I think I've found the solution, setting CreateAppDir=no seems to do the trick.At least its no longer creating an empty folder at the initial dummy location.

-1

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Changing WizardForm.DirEdit.Text in currStepchanged ssInstall does have an effect, thats how i set the actual install folder based on some code choices. – user5388807 Sep 30 '15 at 11:40
  • From your comments and self-answer, I guess you do not install the files to `{app}`, but to `{code:GetFilesDestDir}`. Then it would behave as you describe. But you didn't tell us. – Martin Prikryl Sep 30 '15 at 11:54