Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 26th September 2014, 12:12   #1
getmanup
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,
getmanup is offline   Reply With Quote
Old 28th September 2014, 17:30   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 29th September 2014, 05:27   #3
getmanup
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
getmanup is offline   Reply With Quote
Old 29th September 2014, 14:58   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Why are you using Locate? IfFileExists $INSTDIR\*.* is all you need.

Stu
Afrow UK is offline   Reply With Quote
Old 1st October 2014, 05:25   #5
getmanup
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...
getmanup is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
locate plugin, moving files and folders

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump