Winamp & Shoutcast Forums CopyFiles - rights to copy to C:\Program Files\myprogram\?

 10th September 2014, 18:29 #1 hellik Junior Member   Join Date: Mar 2010 Posts: 14 CopyFiles - rights to copy to C:\Program Files\myprogram\? Hi list, in my nsis-script [1] there is some option to download some extra file from a server. this extra files is stored the user's windows temp folder [2], unzipped and untared. this works fine. then some of these unzipped and untared files should be copied [3] from [2] to a subfolder in the installation folder of my program [4]. but this copying fails; no error in the log windows of the installer, the installer finishes without any error. any idea/hints why these files aren't copied? the installer itself is installed with admin rights; maybe the subprocess of copying isn't allowed to copy to C:\Program Files\myprogram\subfolder? the installer can be tested by [5] best Helmut [1] http://trac.osgeo.org/grass/browser/...aller.nsi.tmpl [2] C:\Users\userxy\AppData\Local\Temp\install_msruntime [3] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L943 [4] C:\Program Files\myprogram\subfolder [5] http://wingrass.fsv.cvut*****grass71...1076-Setup.exe
 11th September 2014, 02:07 #2 demiller9 Senior Member   Join Date: Mar 2006 Location: Dallas Posts: 462 I don't see anyplace that creates your 'extrabin' folder. The CopyFiles command won't create it, it must already exist. Easiest way would be to put a CreateDirectory command right before the CopyFiles command, as the short example in the manual shows. ```code:CreateDirectory "\$INSTALL_DIR\extrabin" CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "\$INSTALL_DIR\extrabin"```
11th September 2014, 20:10   #3
hellik
Junior Member

Join Date: Mar 2010
Posts: 14
Quote:
 Originally Posted by demiller9 I don't see anyplace that creates your 'extrabin' folder. The CopyFiles command won't create it, it must already exist. Easiest way would be to put a CreateDirectory command right before the CopyFiles command, as the short example in the manual shows. ```code:CreateDirectory "\$INSTALL_DIR\extrabin" CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "\$INSTALL_DIR\extrabin"```

in the project there are many files organized in different subfolders (e.g. bin, lib and extrabin) [1] and included in the installer [2].

so 'extrabin', 'bin', 'lib' etc subfolders are there when the many files are installed to c:\Program Files\myprogram.

it could be that the 'extrabin' subfolder isn't ready/created when the extra files are copied by CopyFiles?

will have a look regarding this.

best
Helmut

[1] http://trac.osgeo.org/grass/browser/...r.bat.tmpl#L45
[2] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L527

13th September 2014, 00:14   #4
hellik
Junior Member

Join Date: Mar 2010
Posts: 14
Quote:
 Originally Posted by hellik thanks for your reply. in the project there are many files organized in different subfolders (e.g. bin, lib and extrabin) [1] and included in the installer [2]. so 'extrabin', 'bin', 'lib' etc subfolders are there when the many files are installed to c:\Program Files\myprogram. it could be that the 'extrabin' subfolder isn't ready/created when the extra files are copied by CopyFiles? will have a look regarding this. best Helmut [1] http://trac.osgeo.org/grass/browser/...r.bat.tmpl#L45 [2] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L527
several test done:

[a] folder c:\Program Files\myprogram\extrabin created as one of the first actions taken by the nsis-installer

```code:	;create extrabin folder for ms runtime installation
CreateDirectory "\$INSTALL_DIR\extrabin"```

files are not copied to c:\Program Files\myprogram\extrabin

[b] folder c:\Program Files\myprogram\extrabin created as one of the first actions taken by the nsis-installer

```code:	;create extrabin folder for ms runtime installation
CreateDirectory "\$INSTALL_DIR\extrabin"```

and explicitly copying files to c:\Program Files\myprogram\extrabin by commands

```code:	CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\msvcp60.dll" "\$INSTALL_DIR\extrabin"
CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\msvcp70.dll" "\$INSTALL_DIR\extrabin"
CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\msvcp71.dll" "\$INSTALL_DIR\extrabin"
CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\msvcr71.dll" "\$INSTALL_DIR\extrabin"
CopyFiles "\$TEMP\\$ORIGINAL_UNTAR_FOLDER\bin\msvcrt.dll" "\$INSTALL_DIR\extrabin"```

no files are copied.

any ideas/hints?

best
Helmut

 13th September 2014, 08:29 #5 Afrow UK Moderator     Join Date: Nov 2002 Location: Surrey, England Posts: 8,434 Have you checked your source path is correct? Stu
13th September 2014, 19:13   #6
hellik
Junior Member

Join Date: Mar 2010
Posts: 14
Quote:
 Originally Posted by Afrow UK Have you checked your source path is correct? Stu
yes, the source path is correct.

I think I've narrowed down the issue a little bit more:

in the nsis-script [1] there's the section [2] with the optional download of these gzipped and tared files which, after unzpping and untaring, should be copied to C:\Program Files\myprogram\subfolder.

this section calls [3] the function [4] which download [5] and unzip/untar [6] the archive and then copies some files [7].

now for more testing, I've added some copying commands as the first action of the nsis-installer:

```code:	;test copy files
CreateDirectory "\$INSTALL_DIR\extrabin"
CopyFiles "C:\wd\checkdllnsis\*.dll" "\$INSTALL_DIR\extrabin"
CopyFiles "C:\wd\checkdllnsis\*.txt" "\$INSTALL_DIR\extrabin"
CopyFiles "C:\wd\checkdllnsis\*.exe" "\$INSTALL_DIR\extrabin"
CopyFiles "C:\wd\checkdllnsis\*.dll" "C:\wd\checkdllnsis\copiedf"
CopyFiles "C:\wd\checkdllnsis\*.txt" "C:\wd\checkdllnsis\copiedf"
CopyFiles "C:\wd\checkdllnsis\*.exe" "C:\wd\checkdllnsis\copiedf"```

and all of these test files are copied.

as summary, CopyFiles doesn't seem to work, if the command is nested in a function called in a section; but CopyFiles works, if it is in the main nsis script and not nested in function.

intended behaviour? bug? ... should this be reported anywhere?

best
Helmut

[1] http://trac.osgeo.org/grass/browser/...aller.nsi.tmpl
[2] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L966
[3] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L979
[4] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L900
[5] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L929
[6] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L935
[7] http://trac.osgeo.org/grass/browser/....nsi.tmpl#L943

 14th September 2014, 09:45 #7 Afrow UK Moderator     Join Date: Nov 2002 Location: Surrey, England Posts: 8,434 Can write a script to reproduce? Which NSIS version are you using? Have you tried to see what happens using Process Monitor? CopyFiles just calls a standard Windows API so it is unlikely this is an actual bug. Stu
14th September 2014, 11:22   #8
hellik
Junior Member

Join Date: Mar 2010
Posts: 14
Quote:
 Originally Posted by Afrow UK Can write a script to reproduce? Which NSIS version are you using? Have you tried to see what happens using Process Monitor? CopyFiles just calls a standard Windows API so it is unlikely this is an actual bug. Stu
it's nsis 2.46.

I'll try to write a small script.

14th September 2014, 12:55   #9
hellik
Junior Member

Join Date: Mar 2010
Posts: 14
Quote:
 Originally Posted by Afrow UK Can write a script to reproduce? Which NSIS version are you using? Have you tried to see what happens using Process Monitor? CopyFiles just calls a standard Windows API so it is unlikely this is an actual bug. Stu
you're right.

I've written some simple nsis script (attached) where I copied the section and function from my originally script.

at the moment no idea what happens in my original script ... maybe there is something with the path variable other something other

thanks

best
Helmut
Attached Files
 myfilescopied.nsi (6.0 KB, 242 views)

 Winamp & Shoutcast Forums CopyFiles - rights to copy to C:\Program Files\myprogram\?