0

We have Installshield 2009 for our product. I am trying to muddle my way through it to make some updates (obviously, I am not the original author).

Within, there is a fairly complex arrangement of components and files, plus, there is a script section for some custom work.

I need to accomplish the following, without creating a blank object in the repository.

  1. One of the components needs to create a directory tree (two folders deep).

  2. Within that tree (deepest folder), I need to create a blank file.

Questions:

  1. Do I need to create two components, one for each directory level, or will the tree be created if I specify [INSTALLDIR]folder1\folder2?

  2. I am thinking that the installscript would be the place to create the empty file, based on the CreateFile example in the help. I notice that, in the components page, that, once I typed the value for the Destination property, that a little "tag" of sorts appeared at the start {FOLDER2}. Can I used that tag as an argument to CreateFile and how would I reference it?

Jon
  • 1,675
  • 26
  • 57

1 Answers1

1

Regardless of the project type, I would probably suggest creating the folder structure in the Files and Folders view, and adding the empty file there. It's just simple and you'd be done with fewer chances of error.

As to the questions you asked, neither Basic MSI nor InstallScript projects require components for every folder level on the system. Note that if the folder isn't already there when it executes, the CreateFile approach is unlikely to create the folders for you.

In a Basic MSI project, {FOLDER2} indicates that FOLDER2 is the name of the directory entry, and after CostFinalize there will be a property of the same name that contains its run-time location. You can retrieve it in an InstallScript custom action with MsiGetProperty. In a pure InstallScript project the approach would be a little different, worst case it would be something like TARGETDIR ^ "folder1" ^ "folder2" (my InstallScript is rusty).

Michael Urman
  • 15,737
  • 2
  • 28
  • 44
  • So, it appears the folder is not created when I went to create the file. I adjusted the script to check for the folder and create it if not present, but, at what stage is the folder structure in Files and Folders created? – Jon Nov 10 '15 at 20:14
  • Assuming MSI, after InstallFiles executes (the deferred half). – Michael Urman Nov 11 '15 at 12:57
  • Unsure what you mean by "the deferred half", but, i found that the folder structure was not yet created (the sequence # for my custom action was higher than Install Files) when the custom action executed. Maybe it was cached? As well, the structure was empty, just folders, maybe that has something to do with it too? – Jon Nov 11 '15 at 16:23