We are having a problem deleting a directory that includes an unpacked WAR file during uninstallation. The WAR file is unpacked by Tomcat.

The post uninstall actions include a deleteFile command with the path of the tomcat folder. The uninstall log says, "Cannot delete file C:...tomcat"

We only see a problem when the length of the full path of the longest file in the unpack WAR file is more than approximately 255 characters. If we use a shorter installation path the problem does not occur.

The tomcat service has been shutdown before the attempt to delete the directory and the permissions are correct. We only need to use a shorter installation path to work around the issue.

We have tried the following to resolve the issue

  • Add the unpacked directory to the uninstaller (directory is not removed)
  • Use the Windows rmdir command via runProgram (fails with "unknown error while running rmdir")

We are using InstallBuilder 7.2.5.

asked 31 Oct '12, 08:03

Matthew%20Steed's gravatar image

Matthew Steed
16668
accept rate: 100%


Due to compatibility with older versions of Windows, InstallBuilder does not support paths longer than 255 bytes on this platform.

Regarding rmdir, this command is not an actual binary, but a command accessible from cmd only. The recommended way to delete a directory recursively on Windows is to do:

<runProgram> <program>cmd</program> <programArguments>/C "rd /Q/S ${installdir.dos}\dir"</programArguments> </runProgram>

To ensure the deletion does not fail in case the directory does not exist, what can be done is:

<runProgram> <program>cmd</program> <programArguments>/C "rd /Q/S ${installdir.dos}\dir"</programArguments> <abortOnError>0</abortOnError> <showMessageOnError>0</showMessageOnError> </runProgram>

The <abortOnError> and <showMessageOnError> will run the command without showing error in case it fails.

link

answered 31 Oct '12, 10:59

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

This solution worked and I've marked it as the correct answer.

In case anyone else comes across this problem, you need to make sure you used to .dos modified or it won't work.

(01 Nov '12, 07:13) Matthew Steed
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:

×9

Asked: 31 Oct '12, 08:03

Seen: 2,435 times

Last updated: 26 Jul '16, 09:19