I am a newbie to NSIS, but I saw how all the wonderful things can be done using this light weighted script.
Can anyone please help me out ?
Here's what I Need
- If the installation directory is not empty, read one txt file to know the installed version
- if the already installed version is OLDER than the one which we are installing, then
- copy the contents of the INSTDIT to INSTDIR_Bkp
- else if the Version is same , leave the INSTDIR as such
Thanks in advance,
Need to copy the contents of the Instllation directory into Another Directory
5 posts
Firstly I would grab the current version from the application executable using GetFileVersion rather than use a text file.
Look at VersionCompare and CopyFiles in the manual.
Stu
Look at VersionCompare and CopyFiles in the manual.
Stu
First of all, thanks a lot Afrow UK
I'm using the same code which I got from web, But its throwing an error every time I run the makensis.exe
#CODE
Section
#MessageBox mb_iconstop '$INSTDIR'
StrCpy $R0 "$INSTDIR"
StrCpy $R1 "$INSTDIR_BKP"
StrCpy $R2 0
StrCpy $R3 0
${locate::Open} "$INSTDIR" "/L=FD" "Example5"
IfErrors 0 +2
MessageBox MB_OK 'error' IDOK +4
StrCmp $R3 0 0 +2
MessageBox MB_OK '$R2 files were moved' IDOK +2
MessageBox MB_OK '$R2 files were moved$\n$R3 files were NOT moved'
SectionEnd
Function Example5
StrCmp $R8 $R1 +6
IfFileExists '$R1\$R7' +4
Rename $R9 '$R1\$R7'
IntOp $R2 $R2 + 1
goto +2
IntOp $R3 $R3 + 1
Push $0
FunctionEnd
#ERROR
[nsis] Error in macro locate::Open on macroline 2
[nsis] Error in script "<PATH>\FullInstall.nsi" on line 50 -- aborting creation process
Line no 50 is the one with ${locate::Open} call
I'm using the same code which I got from web, But its throwing an error every time I run the makensis.exe
#CODE
Section
#MessageBox mb_iconstop '$INSTDIR'
StrCpy $R0 "$INSTDIR"
StrCpy $R1 "$INSTDIR_BKP"
StrCpy $R2 0
StrCpy $R3 0
${locate::Open} "$INSTDIR" "/L=FD" "Example5"
IfErrors 0 +2
MessageBox MB_OK 'error' IDOK +4
StrCmp $R3 0 0 +2
MessageBox MB_OK '$R2 files were moved' IDOK +2
MessageBox MB_OK '$R2 files were moved$\n$R3 files were NOT moved'
SectionEnd
Function Example5
StrCmp $R8 $R1 +6
IfFileExists '$R1\$R7' +4
Rename $R9 '$R1\$R7'
IntOp $R2 $R2 + 1
goto +2
IntOp $R3 $R3 + 1
Push $0
FunctionEnd
#ERROR
[nsis] Error in macro locate::Open on macroline 2
[nsis] Error in script "<PATH>\FullInstall.nsi" on line 50 -- aborting creation process
Line no 50 is the one with ${locate::Open} call
Why are you using Locate? IfFileExists $INSTDIR\*.* is all you need.
Stu
Stu
Hello Stu,
I am completely new to this scripting language, So i just used the code given in the nsis forum 🙂.
The issue is resolved, I used another function (MoveFileFolder). This worked perfectly.
Now only part left is deciding when to take the backup and when to over-write (if its a previous version- then take bacup, else jst overwrite the files).
Thanks a ton for your help Stu...
I am completely new to this scripting language, So i just used the code given in the nsis forum 🙂.
The issue is resolved, I used another function (MoveFileFolder). This worked perfectly.
Now only part left is deciding when to take the backup and when to over-write (if its a previous version- then take bacup, else jst overwrite the files).
Thanks a ton for your help Stu...