I am having an issue when trying to use a runProgram block to get a standalone version of 7Zip to extract a zip file from the installers dist folder as a post installation step, and I am using Install Builder 6.5.3.

The code I have for the runProgram block is:

<runProgram>
  <program>"${productdir}/windows/utils/7z.exe"</program>
  <programArguments>-y x "${installer_directory}/dist/archives/${zip_name}" -o".shared/assets"</programArguments>
  <useMSDOSPath>0</useMSDOSPath>
  <workingDirectory>${productdir}</workingDirectory>
  <ruleList>
    <compareText>
      <logic>equals</logic>
      <text>${platform_name}</text>
      <value>windows</value>
    </compareText>
    <fileExists path="${productdir}/.shared/assets" />
    <fileExists path="${installer_directory}/dist/archives/${zip_name}" />
  </ruleList>
</runProgram>

${productdir} is being set as a directoryParameter somewhere else in the script, and ${zip_name} is being set as part of a foreach block.

When this runs on Windows (currently only tested on Windows XP) I get the following error:

Problem running post-install step. Installation may not complete correctly
Unknown error while running "C:\Program Files/My App Path/windows/utils/7z.exe" -y x "D:\/dist/archives/books1.zip" -o".shared/books"

I suspected that it was because the output had mixed forward and backslashes in there but if I try the same command in a DOS box then it works just fine. I've also tried hardcoding the value to a windows friendly path with no success.

So does anyone have any suggestions on how I can get Install Builder to play nicely with the 7zip exe?

Should point out that I am trying to unzip this way rather than use the Install Builder built in unzip utility as the zip files are quite large and also we found that the unzip utility to be quite slow when faced with the number of files we need to extract.

asked 24 May '12, 13:35

sleepingstu's gravatar image

sleepingstu
5113
accept rate: 0%

Just to add...

I realise I put -o".shared/assets" in the runProgram block and -o".shared/books" in the error message, I have to foreach blocks to copied the code out of the wrong one.

(24 May '12, 13:40) sleepingstu

Also I've just tried using a newer version of Install Builder (8.1.0) but still have the same issue.

(24 May '12, 13:50) sleepingstu

I'm not sure if that is the only cause of the error but the <program> should not be enclosed in quotes (InstallBuilder treats everything as the binary path and interpretes it as a relative path starting by "). Could you try the below instead?

<runProgram>
  <program>${productdir.dos}/windows/utils/7z.exe</program>
  <programArguments>-y x "${installer_directory.dos}/dist/archives/${zip_name}" -o".shared/assets"</programArguments>
  ...
</runProgram>

If it also fails, could you also try removing the quotes surrounding .shared/assets?

link

answered 25 May '12, 04:09

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Yep that fixed it. I was assuming I need the path to be quoted as there was potential spaces in it.

I also took the quotes of the -o parameter like you said, and simplified the paths using the workingDirectory and everything is good.

If anyone needs it here is my updated code:

<runprogram>
  <program>windows/utils/7z.exe</program>
  <programarguments>-y x "${installer_directory}/dist/archives/${zip_name}" -o.shared/assets</programarguments>
  <usemsdospath>0</usemsdospath>
  <workingdirectory>${productdir}</workingdirectory>
  ...
</runprogram>
(25 May '12, 05:22) sleepingstu

Thanks for sharing your solution. As additional information, in the <runProgram> action, the <program> tag does not require quoting because InstallBuilder knows it points to the program to execute so spaces are not confused with the end of the command and the start of the arguments.

(25 May '12, 05:57) juanjo ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×176
×155
×55
×19
×13
×1

Asked: 24 May '12, 13:35

Seen: 2,893 times

Last updated: 25 May '12, 05:57