Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to leave changed files during uninstall


9 replies to this topic

Bert

Bert
  • Members
  • 4 posts

Posted 17 June 2004 - 13:19

Hello,

I'm working on a Basic MSI Project with Installshield Dev 8

I want to leave files during the uninstall procedure that are changed by the user.

Now I know how to force installer to leave files (Permanent property).
But what I want is this:
If the file is the same as during the installation -> Delete during uninstall.
If the file is changed by the user -> Leave file during uninstall.

Has anybody a clue how to do this?

Best Regard,
Bert

berno

berno
  • Members
  • 16 posts

Posted 18 June 2004 - 09:15

If the file is a text file I would write a script which searches the file on Strings which could be altered (you can find an example of such a script on this domain under InstallScript Examples). Dependend on the search result you can remove or leave the file on the target system. To execute the script I would use a custom action which I would call during the uninstall procedure (condition Installed).

Hope this helps.

berno

Bert

Bert
  • Members
  • 4 posts

Posted 23 June 2004 - 08:42

Hi Berno,

Thank for your answer, but I'am affraid that this is not really an option.
The file is a very big xml file. A change could be anywhere in the file. You don't know the string to search for.

As I understand, there is no standard functionality for this issue?

Best Regards,
Bert

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 June 2004 - 12:20

To find out whether the file has changed after it has been insstalled you could compare the create date and the modufied date of the file.
To leave the file behind you would have to copy it to a temp location before it gets deleted, and then move it back.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 June 2004 - 12:20

P.S. there is no standard functionality for this, you would have to write a custom action for this purpose.

Bert

Bert
  • Members
  • 4 posts

Posted 25 June 2004 - 13:20

Thanks !

But... How do I get the modified date of a file
(Created date I can get with "GetFileInfo" ?)


Best Regards,
Bert

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 June 2004 - 13:46

Can you use Microsoft's "Scripting Runtime Library"? If so the DateLastModified property should contain what you need (there is also a DateCreated).

http://msdn.microsof...riptRuntime.asp

http://msdn.microsof...l/jsobjFile.asp

Edited by Glytzhkof, 25 June 2004 - 13:46.

Regards
-Stein Åsmul

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 June 2004 - 13:48

I did some date checking logic once, and ran into a lot of problems with daylight savings time and regional settings. I don't think you will have this problem since you are comparing two date/time settings for the same file system object.

Daylight savings time will shift the time you get back from the system with one hour. If you are checking file date/time stamps on disk with a reference list, this can result in erronously assuming the files are all changed, when they are really thrown off by DST.

Edited by Glytzhkof, 25 June 2004 - 13:51.

Regards
-Stein Åsmul

Bert

Bert
  • Members
  • 4 posts

Posted 25 June 2004 - 14:08

Thanks for you aswer.


Is there no way to do it by Installshiel Installscript?


Best regards,
Bert


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 26 June 2004 - 14:01

You should be able to access this function since it is in a COM server dll. Read in the Installscript help file how to call a COM server. There is probably also a sample you can download from Installshield's knowledge base: http://www.installshield.com/support
Regards
-Stein Åsmul