VPatch plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(nsisPatchGen now handles paths with spaces in the name)
Line 24: Line 24:


[http://sourceforge.net/projects/nsispatchgen http://sourceforge.net/projects/nsispatchgen]
[http://sourceforge.net/projects/nsispatchgen 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:
<highlight-nsis>
; 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
</highlight-nsis>
The comments are the original lines.

Revision as of 14:50, 10 November 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