dr_legg
18th December 2009 09:35 UTC
Problem copying file to $APPDATA
I'm trying to copy a file into the $APPDATA folder but it's not working.
I have the following:
SetShellVarContext all
CopyFiles "$INSTDIR\Configuration.xml" "$APPDATA\MyApp\Configuration\Configuration.xml"
The folder exists, as does the file so why doesn't it work?
Thanks
Clegg
MSG
18th December 2009 09:51 UTC
You probably don't have write permissions in the directory. Try running as admin.
dr_legg
18th December 2009 09:54 UTC
I am logged on to my machine as an administrator - I can copy files manually to this directory with no problem.
Is this what you meant or do I need to set something in the installer?
Thanks
MSG
19th December 2009 12:55 UTC
Hmm. First order of business would probably be to isolate the cause of the problem. Create a skeleton installer that only tries to copy the file:
Outfile "test.exe"
requestexecutionlevel admin
Section
SetShellVarContext all
SetOutPath "$APPDATA\MyApp\Configuration"
CopyFiles "$EXEDIR\Configuration.xml" "$APPDATA\MyApp\Configuration\Configuration.xml"
SectionEnd
If that works, the problem lies elsewhere in your installer. If if doesn't work... Well, I'm not sure why it wouldn't work. But at least you'll know it's caused by either the folder creation or file copying commands.
dr_legg
23rd December 2009 10:49 UTC
Many thanks for the reply - i've discovered the problem and as per usual it's my own stupid fault!
The application has a folder in the Program Files directory as well as $APPDATA - I copied and pasted the one from Program Files and it's ever so slightly different which caused the error
....\Provider\App2.0\AppAgent\ as opposed to
....\Provider\App2.0\App Agent\
it's a 3rd party app so I can't make them both the same but at least I know what the problem is now.
Thanks for all your help and sorry for wasting your time.
Clegg