Copy local files does not work

Got a problem you cannot solve? Try here.
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Copy local files does not work

Post by QooScho »

Hello

While installing I edit a ini file. Then I want to copy it to Windir.
But the local copy file command das not work.

Set Variable BackSlashToSlash to $PROGDIR$
Replace \ with / in variable BackSlashToSlash
EditFile $PROGDIR$\mysql\bin\my.ini, Replace "/xampplite" with "$BackSlashToSlash$"
Copy Local Files $PROGDIR$\mysql\bin\my.ini to $WINDIR$
Any idea why the file my.ini is not copied to C:\windows ?

best regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

Dear Hansjoerg,

Perhaps you do not have the necessary permissions?
Try copying it to a different folder (c:\ for example) and see if it works.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Copy local files does not work

Post by QooScho »

Hello,
thank you for help.
I do not think that it is a permission problem.

If I use Install Files instead of Copy Local Files the file will be copied to Windows.
But then the problem is that the EditFile function will not work.

Install Files d:\Q8Install.Aware\Sources\mysql\bin\my.ini to $WINDIR$ (Permanent, Never Overwrite)
Comment: EditFile $PROGDIR$\mysql\bin\my.ini, Replace "/xampplite" with "$BackSlashToSlash$"
Set Variable BackSlashToSlash to $PROGDIR$
Replace \ with / in variable BackSlashToSlash
EditFile $WINDIR$\my.ini, Replace "/xampplite" with "$BackSlashToSlash$"

This is done before Apply Install section

[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Apply Install (get result into variable SUCCESS)
if Variable SUCCESS not Equals ERROR
if Variable SUCCESS not Equals CANCEL
Comment: TO-DO: Install additional components (Run)
end
end
end
[compiler end]
Set Variable PROGRESS to 100

Why does Install Files work but EditFile not?
And Copy Local File?

regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

Hansjoerg,

I think that this happens because you are not calling Apply Changes. Remember that IA commands are cached (they are not actually executed until Apply Changes is called). Therefore, the file will not be copied until you call Apply Changes. Try turning on the Native Engine (Set Variable NATIVE_ENGINE to TRUE) and see if that changes anything.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Copy local files does not work

Post by QooScho »

Dear Aviv,
this was a good idea.
I have added
Set Variable NATIVE_ENGINE to TRUE
at the beginning of the configuration script
and now the "Copy local File" will work.

Can I leave "Set Variable NATIVE_ENGINE to TRUE" in my code ?
what is the meaning of "Apply Changes" and where I have to place this?

kind regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

Dear Hansjoerg,

The Native Engine is an InstallAware mechanism that allows you to execute your setup independent from Windows Installer. Type Native Engine in the F1 help files in IA for more information.
The Apply Changes simply commits all your commands if the Windows Installer engine was used (aka if the Native Engine was not used). I would suggest reading the help file for Apply Changes as well.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Copy local files does not work

Post by QooScho »

Dear Aviv,

I cannot find any information about Native Engine in the F1 help file.

regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

Please refer to this guide for more information on the Native Engine:

http://www.installaware.com/installaware_reviewers_guide.pdf
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Copy local files does not work

Post by QooScho »

Dear Aviv,

in the meantime I read a lot in the help and in the forum.
As I understand it right, NATIV_ENGINE is only available at version 10 of IA, right?
But I am using version 9.
So I think Native_engine=true takes no effect?

so what can I do to use Copy Local Files AFTER Apply Install?
you told me something with Apply Changes, but if I drag & drop Apply Changes to the MSICode then there is Apply Install, not Changes.

what happens?
best regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

True, the Native Engine was introduced in InstallAware 10.

Apply Changes is a group of command (Apply Install, Apply Uninstall, Apply Advertised).
What you can do, although highly not recommended, is call Apply Install again after the copy local files command.
This is not recommended, and instead I would advise you to redesign your installer so all commands go before the Apply Install.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
QooScho
Posts: 152
Joined: Fri Apr 15, 2011 1:02 am

Re: Copy local files does not work

Post by QooScho »

Hello Aviv,

<<This is not recommended, and instead I would advise you to redesign your installer so all commands go before the Apply Install.

so that is what it makes relly dificult and why I spent so much time.
I can use Copy local File before Apply Install.
BUT, I also need EDIT FILE to edit a configuration file. And Edit File is needed AFTER Apply Install!
After I have edit the configuration file I can copy it.

How can you do this?

regards
Hansjoerg
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

You can include it as a support file, edit it there (it will be located at $SUPPORTDIR$), and then install it with the Install Files command.
This way the Apply Install structure remains the same.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
agrogers
Posts: 21
Joined: Fri Jul 04, 2008 12:09 am
Location: Australia

Re: Copy local files does not work

Post by agrogers »

The issue for me was that i had assumed that because the CopyLocalFiles was the LAST entry in my script that it would be the last thing done. I wanted to install a default file BUT overwrite that file with a local copy if one was found. However it appears that the local copy either wasnt being installed or was being installed before the one bundled in the EXE. The end result being that the local copy didn't seem to be working.

I fixed my issue by commenting out the default file in the install. Fortunately this is a viable solution for me.

I find these sorts of things very frustrating. I think it is just the MSI framework so i think the new install option could solve a lot of headaches like this.
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Copy local files does not work

Post by giaviv »

Hi,

What happens is that purple commands (such as Install Files and Copy/Move Local Files) do not get executed until Apply Changes is called.
This can be avoided all together by the use of the Native Engine - simply turn it on by setting the variable NATIVE_ENGINE to TRUE and all commands will execute when they are called. Read more about the Native Engine by searching "The Native Engine" in the InstallAware help files.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
agrogers
Posts: 21
Joined: Fri Jul 04, 2008 12:09 am
Location: Australia

Re: Copy local files does not work

Post by agrogers »

My experience seemed different to that. I was applying the changes and did have the copy local files option run prior to the apply changes. However my file still wasnt appearing.

My problem was that i was both installing the file normally and then trying to copy over the top of it with the CopyLocalFiles option. Either the option wasnt working OR it was doing the CopyLocalFiles PRIOR to the standard file install.

The Native installer sounds good. Sadly i am on an older version. If you can offer me a good upgrade price i could be enticed to upgrade. I think most of my frustrations are with Windows installer which i have grown some dislike for :) So a Native installer sounds good.

Cheers
Andrew
Post Reply