We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

darrenp
Posts: 4
Joined: Tue Sep 26, 2006 11:05 am

Overwriting Read Only files?

I've come across a small issue trying to overwrite files previously created by a non MSI product, ie simple file copy.

If these files came from a CD then obviously the Read Only attribute is set, unless someone specifically resets it.

It seems the MSI skips over these read-only files and only updates what it can.

I thought the MSI ma have worked at a lower level, as it were, but is there a way to always force an overwrite of these 'unknown' read only files?

Thanks in advance.
Darren
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
I thought the MSI ma have worked at a lower level, as it were, but is there a way to always force an overwrite of these 'unknown' read only files?
I test this and the files with read only flag are always overwritten. So I think that the files are not overwritten because of the file version. So you need to specify a bigger version for all files that you want to be overwritten. To do this select the file and choose properties from the context menu. Switch to "Version" tab and in the "Overwrite with this" filed type 999.

Hope this helps.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
darrenp
Posts: 4
Joined: Tue Sep 26, 2006 11:05 am

Thanks for the reply.

If it is the 'version' identifier that is causing the problem then this unfortunately leads me into another issue.

Say my install contained 50-100 html/asp/aspx files then obviously the version information cannot be read from a file, but I also do not want to have to update the properties/version tab of each one of these files within the MSI. I would like to update the source files on disk and have the MSI automatically include these every time I create a build.


Thanks in advance.
Darren
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Are you sure that the behavior above is related to those file types (html/asp). Because obviously those type of files does not have a version number.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
darrenp
Posts: 4
Joined: Tue Sep 26, 2006 11:05 am

It appears so. Can't put my finger on what is causing some of the plain-text files to not be deployed. Originally thought about 'read-only' scenarios, but you have since re-tested this, and obviously the plain-text files do not contain version information.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

You can make a VBS custom action that deletes the old files before installing the new files.
Switch to "Custom Actions" page and a "New Attached Custom Action" under "CostFinalize" standard action and select the .vbs file. Use following options for the custom action:
1. Function Name: empty
2. Execution Properties: ignore return code
3. Execution Condition: Not Installed

Here is the VBS code for the custom action:

Code: Select all

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = Session.Property("APPDIR")
strFolder = Left(strFolder, len(strFolder)-1)
msgbox strFolder
fso.DeleteFolder strFolder, true
Hope this helps.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
bloke
Posts: 8
Joined: Tue Sep 26, 2006 4:05 pm

gigi wrote:Hi,

You can make a VBS custom action that deletes the old files before installing the new files.
Switch to "Custom Actions" page and a "New Attached Custom Action" under "CostFinalize" standard action and select the .vbs file. Use following options for the custom action:
1. Function Name: empty
2. Execution Properties: ignore return code
3. Execution Condition: Not Installed

Here is the VBS code for the custom action:

Code: Select all

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = Session.Property("APPDIR")
strFolder = Left(strFolder, len(strFolder)-1)
msgbox strFolder
fso.DeleteFolder strFolder, true
Hope this helps.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
I had to resort to doing a script like this to delete an existing EXE that was being replaced with a tweaked one with the same version number (long story ;)). It worked a treat with replacing the file but the trouble is it won't uninstall the new EXE when going through the uninstall motions, even though nothing is flagged as permenant :?

Code: Select all

Dim objFSO, objFileDelete
Dim strFilePath

strFilePath = Session.Property("MYFILE_INSTALLED") + "\myfile.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileDelete = objFSO.GetFile(strFilePath)
objFileDelete.Delete ()

Set objFileDelete = Nothing
Set objFSO = Nothing
darrenp
Posts: 4
Joined: Tue Sep 26, 2006 11:05 am

Thanks for all the help. Sorry I didn't come back sooner.

Return to “Common Problems”