Page 1 of 1

Can't overwrite file

Posted: Tue Apr 25, 2006 11:57 am
by Guest
I've got an issue where a certain file in my installation might already exist. If it does, I want to overwrite it with the file included in the install. However, it isn't being overwritten. I'm not sure what I'm doing wrong but here is an example project.

To recreate:
Install.
Copy the only file it installs (temp.tmp) to the same directory; so there is "temp.tmp" and "copy of temp.tmp" in the same directory.
uninstall.
rename "copy of temp.tmp" to "temp.tmp" and change the contents of the file so you can know if it was replaced.
Install again.

The second install appears to work normally but temp.tmp never gets overwritten with a fresh copy. It still has my changes in it. What am I doing wrong?

File Attached:

My Installation Project.mia

Posted: Tue Apr 25, 2006 12:37 pm
by jimo
If you double click the Install Files command for the file tmp.tmp in the code editor are there any check boxes marked?

And, the beset way is to inlcude the *.mpr file with the *.mia file in a zip so we can open the project.

Posted: Tue Apr 25, 2006 1:51 pm
by Guest
No boxes are checked.

File Attached:

My Installation Project.zip

Posted: Tue Apr 25, 2006 3:44 pm
by MichaelNesmith
Windows Installer internally manages overwrites. So what you want to do is make sure your file has a newer version, or if that is not possible (like a plain text file), a newer date. Then the overwrite will happen automatically.

If you would like to force an overwrite, you can do that too. Just delete the file manually before installing the new copy. You can use the DeleteFileA API in kernel32.dll with the Call DLL Function plug-in to do this.