Skip to content
⌘ NSIS Forum Archive

CopyFiles - rights to copy to C:\Program Files\myprogram\?

9 posts

hellik#

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
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.

CreateDirectory "$INSTALL_DIR\extrabin"
CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
hellik#
Originally Posted by demiller9 View Post
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.

CreateDirectory "$INSTALL_DIR\extrabin"
CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
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
hellik#
Originally Posted by hellik View Post
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

	;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

	;create extrabin folder for ms runtime installation
CreateDirectory "$INSTALL_DIR\extrabin"
and explicitly copying files to c:\Program Files\myprogram\extrabin by commands

	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
hellik#
Originally Posted by Afrow UK View Post
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:

	;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
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
hellik#
Originally Posted by Afrow UK View Post
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.
hellik#
Originally Posted by Afrow UK View Post
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.

downloading, extracting and copying to to C:\Program Files\myprogram\subfolder works here.

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