1

In Inno Setup, is there a way to set the deployment directory in code, before the "select destination location" wizard screen comes up?

I have the DefaultDirName set in the [Setup] section like so:

DefaultDirName=C:\Program Files\MyAppDefaultDir

but I have code that reads in options from a file, and one of those options may be a different deployment directory, so I'd like to set the deployment directory in code so that when I get to the "select destination location" it shows the appropriate directory already.

Something like:

{app} = 'c:\Some_other_install_dir';

Though I know that won't work.

Mike
  • 1,246
  • 3
  • 20
  • 34
  • possible duplicate of [Inno Setup - Setting DefaultDir using wildcard registry entry?](http://stackoverflow.com/questions/15613178/inno-setup-setting-defaultdir-using-wildcard-registry-entry) – TLama Mar 12 '14 at 19:10
  • I've marked this question as duplicate even though it's not the exact duplicate (you're reading the path from file whilst the OP there from registry). However, the principle is there ;-) – TLama Mar 12 '14 at 19:13
  • @TLama - I saw that post, he's calling a code block from up in the setup block, but I'm not sure I can get away with that. At that point I don't think libraries are loaded and such, which is what we use to read in the file. – Mike Mar 12 '14 at 20:11
  • Err, which libraries do you mean ? You've said *"I have code that reads in options from a file"* and that's what you can safely do there. It is safe even if you were using statically linked DLL libraries because they are loaded when the code runner is created (and only code runner can execute anything from code section). – TLama Mar 12 '14 at 20:28
  • If it's an ini file, you can just use an `{ini:...}` constant. – Miral Mar 13 '14 at 07:50
  • @TLama - that's what it does, uses an external library to read in the file. I'll double check what I'm doing there, see if I can't load it out of code at that time. – Mike Mar 17 '14 at 18:03
  • I can tell you for sure that (at least the most recent version I've checked the source of) first loads the statically linked libraries and then exetutes the first event method. – TLama Mar 17 '14 at 18:44

0 Answers0