cinoaz
Posts: 3
Joined: Sat Dec 08, 2007 10:13 pm

Unable to overwrite file in destination?

Sun Dec 09, 2007 4:09 pm

I checked the FAQs, forum searches, and tutorials, and I got most of the way, however I have a problem with not able to overwrite a file.

I have my install routine, and it copies new files just fine, however, we use Textpad, to edit our source files, this is a stand alone application. I created a syntax file for our source code to enable color coding of the code while editing in textpad.

This Syntax file must reside in the Textpad application folder. So, I created a search in the installer and looked for our file, ssl.syn , since the person could have installed the application on any drive, any location.

I then created a new "Properties" folder in Files and Folders, assigned it the local search function to get the path to the file, then added the newer version of the syntax file in that folder.

During install, everything goes swimmingly, until the installer tries to replace the ssl.syn file, then I get an error saying, "Cannot overwrite file, please rename or remove file first".

Nothing is running, that file is not being accessed, I even rebooted the PC to make sure nothing was hanging onto that file, still the same error. I went into properties for that file in Advanced Installer, made sure everything was set, tried to add user permissions to the file in the installer routine, etc, etc...

Why do files get copied over no problem that reside in my "Application" folder, but files elsewhere don't get overwritten? What did I miss?

Quadiago
Posts: 71
Joined: Thu May 31, 2007 9:07 am

Mon Dec 10, 2007 6:49 am

I think the problem isn't that its not able to overwrite the file, it's probably because of that property (search) based folder not working correctly. Windows Installer almost never complains visually about not being able to replace a file.

You should run the install with logging enabled and check what the value of the search property is.

Just a note:
If you set up a search for a file, WI won't search the entire machine for it. It'll only search a certain folder and x-amount of levels into that.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Mon Dec 10, 2007 2:23 pm

Hi,

You are encountering this behavior because you are using the result of a file search to define a property-based folder. The search will be resolved to the path of a file, not to the path of a folder, therefore the property-based folder will have an invalid path at runtime.

For more information about the "Search" page please follow this link:
http://www.advancedinstaller.com/user-guide/search.html

The solution is to use a custom action that removes the file name from the path stored in the property of the search. This custom action will be scheduled under the "AppSearch" standard action in the "Custom Actions" page.

You can read more about custom actions here:
http://www.advancedinstaller.com/user-g ... -page.html

Another solution would be to use a search for a folder, not a file.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

cinoaz
Posts: 3
Joined: Sat Dec 08, 2007 10:13 pm

Mon Dec 10, 2007 8:25 pm

The search will be resolved to the path of a file, not to the path of a folder, therefore the property-based folder will have an invalid path at runtime.
Ohhh... Ahhhh...., now I see it. Yep, I knew it was something like that. Thank you very much.

But, The Help File entry, do a search for these keywords:

How do I install some files in a folder of a previously installed application

The text in that help is misleading. Now that I know about folders and filenames, re-reading it I can pick up on the nuances, however, I would suggest rewording that section in terms of replacing files and using the property folder.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:  Website

Tue Dec 11, 2007 8:09 am

Hi,
I would suggest rewording that section in terms of replacing files and using the property folder.
Thank you for your suggestion.
We are always trying to improve Advanced Installer and it documentation, therefore we appreciate any suggestions.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”