FileCopy: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(SF: diferent -> different.)
(SF: Cleaned page.)
Line 1: Line 1:
== Description ==
This macro makes "CopyFiles" to don't set the error flag when copying files to an inexistant folder.
== How To Use ==
<highlight-nsis>
${FileCopy} "filespec_on_destsys" "destination_path"
</highlight-nsis>
== The Script ==
== The Script ==
<highlight-nsis>
<highlight-nsis>
;This macro will help you copy a file to
;different directory (or directories) without compile it twice.
;Enjoy.
;Sorry for my really bad english. :D
;Script based in ${NSISDIR}\Examples\Example1.nsi
;you can use this macro as many times you want in your script
!macro FileCopy FilePath TargetDir
!macro FileCopy FilePath TargetDir
;Now the macro create the dir first :)
  CreateDirectory ${TargetDir}
;If the dir doesn't exists, It'll be created.
  CopyFiles ${FilePath} ${TargetDir}
CreateDirectory ${TargetDir}
CopyFiles ${FilePath} ${TargetDir}
!macroend
!macroend
Name "CopyME"
OutFile "copyme.exe"
InstallDir $PROGRAMFILES\CopyMe
DirText "Select a dir, Dude"
Section "ThisNameIsIgnoredSoWhyBother?"
SetOutPath $INSTDIR
File "${NSISDIR}\makensisw.exe"
File "me.txt"
!insertmacro FileCopy "$INSTDIR\makensisw.exe" "$INSTDIR\copy"
!insertmacro FileCopy "$INSTDIR\me.txt" "$INSTDIR\backup"
!insertmacro FileCopy "$INSTDIR\me.txt" "$SYSDIR"
SectionEnd
</highlight-nsis>
</highlight-nsis>


Page author: Joelito
Page author: Joelito

Revision as of 13:09, 17 April 2005

Description

This macro makes "CopyFiles" to don't set the error flag when copying files to an inexistant folder.

How To Use

${FileCopy} "filespec_on_destsys" "destination_path"

The Script

!macro FileCopy FilePath TargetDir
  CreateDirectory ${TargetDir}
  CopyFiles ${FilePath} ${TargetDir}
!macroend

Page author: Joelito