|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
|
#1 |
|
Junior Member
Join Date: Sep 2014
Posts: 3
|
Need to copy the contents of the Instllation directory into Another Directory
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, |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2014
Posts: 3
|
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 |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Why are you using Locate? IfFileExists $INSTDIR\*.* is all you need.
Stu |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Sep 2014
Posts: 3
|
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... |
|
|
|
![]() |
|
|||||||
| Tags |
| locate plugin, moving files and folders |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|