VPatch plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 36: Line 36:
; Library for use with VPatch (DLL version) in NSIS 2.0.5+
; Library for use with VPatch (DLL version) in NSIS 2.0.5+
; Created by Koen van de Sande
; Created by Koen van de Sande
; Macro fixed by Herberth Alvarado
; Macro enhanced by Herberth Alvarado


!macro VPatchFile PATCHDATA SOURCEFILE TEMPFILE
!macro VPatchFile PATCHDATA SOURCEFILE TEMPFILE

Revision as of 21:54, 1 February 2007

Author: joost (talk, contrib)


Links

The latest version of VPatch is 3.1.
VPatch Home Page

Description

It calculates the difference between two (or more) similar files: a new version and several old versions. When you release a new version, you might want to offer a patch update to the users, instead of including the entire file again. So you include the small patch file generated by VPatch in your installation, together with the VPatch runtime DLL for NSIS (which is 8 KB), and you save your users a lot of downloading.

Credits

VPatch is a NSIS plugin written by Koen van de Sande.

Related Software

nsisPatchGen

The nsisPatchGen utility recursively compares two directory structures looking for changes to the files and subdirectories. It produces an NSIS include file containing functions that will perform a patch upgrade from the original structure to the new.

nsisPatchGen uses the VPatch genpat.exe utility to generate patch files, and calls VPatch plugin function calls from the generated NSIS file.

nsisPatchGen can be downloaded from:

http://sourceforge.net/projects/nsispatchgen


The nsisPatchGen has a little problem, the NSIS include file doesn't compile if the file to patch has 'blanks' in the name. I was looking for a good way to fix the problem and the this is simplest one:

; PatchLib v4.0
; =============
;
; Library for use with VPatch (DLL version) in NSIS 2.0.5+
; Created by Koen van de Sande
; Macro enhanced by Herberth Alvarado
 
!macro VPatchFile PATCHDATA SOURCEFILE TEMPFILE
  InitPluginsDir
;  File /oname=$PLUGINSDIR\${PATCHDATA} ${PATCHDATA}
  File "/oname=$PLUGINSDIR\${PATCHDATA}" "${PATCHDATA}"
  vpatch::vpatchfile "$PLUGINSDIR\${PATCHDATA}" "${SOURCEFILE}" "${TEMPFILE}"
  Pop $1
  DetailPrint $1
  StrCpy $1 $1 2
;  StrCmp $1 "OK" ok_${SOURCEFILE}
  StrCmp $1 "OK" +2
  SetErrors
;ok_${SOURCEFILE}:
;  IfFileExists "${TEMPFILE}" +1 end_${SOURCEFILE}
  IfFileExists "${TEMPFILE}" +1 +3
  Delete "${SOURCEFILE}"
  Rename /REBOOTOK "${TEMPFILE}" "${SOURCEFILE}"
;end_${SOURCEFILE}:
  Delete "$PLUGINSDIR\${PATCHDATA}"
!macroend

The comments are the original lines.