ramesh sriram
ramesh sriram

Reputation: 67

Identifying file updations in NSIS

In NSIS is there any way to identify whether the application file is modified from the user side while updating the application using installer?

My requirement is while updating the application, we need to give warning message in case of user modify the application file. If 'Yes' we need to update the file, otherwise we should not update.

Upvotes: 0

Views: 192

Answers (2)

Silin Misler
Silin Misler

Reputation: 1

Use archive attribute. Archive attribute is there especially for such purpose.

Below steps demonstrates the behaviour of archive bit:

  1. Unset archive bit of any file in your pc, using Properties > advanced > untick "File is ready for archiving"
  2. Edit and save the file with an appropriate tool. For example Notepad for a text file.

Note that archive bit of the file is set, signalling that this file is modified.

So the method will be like this:

  1. Unset archive bit of all necessary source files in NSIS compiler PC
  2. In NSIS script use [File /a] to extract the source files to destination computer preserving attributes
  3. While reinstalling use GetFileAttributes to detect if the file is modified or original and take steps accordingly.

Upvotes: 0

Anders
Anders

Reputation: 101756

You probably have two options; you can get the modified time with GetFileTime or use something like the MD5 plugin (md5dll::GetMD5File).

You could save the original values in a .ini when you install and then compare with these values when updating...

Upvotes: 2

Related Questions