Skip to content
⌘ NSIS Forum Archive

Simple question

9 posts

jlee#

Simple question

I have a massive program (19,000+ files) that I am writing an installer for. There are obviously many sub directories and so on. Is there a simple script or function that I can use intead of listing each file individually?
jlee#
I am trying this, but I got the error,

Error in script "C:\Program Files\NSIS\Examples\ttp\ttp.nsi" on line 126 -- aborting creation process

Section -post
  SetOutPath "$INSTDIR"
  ;Store installation folder
  WriteRegStr HKCU "Software\Timber Ticket Pro" "" $INSTDIR
  
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"
  
  
 ;Create Xampp folder
  CreateDirectory "$INSTDIR\zertis_xamp"
  SetOutPath "$INSTDIR\zertis_xamp\"
;  !include "ttp.nsh"
    StrCpy $R0 "zertis_xampp\"   ;Directory copy from
    StrCpy $R1 "$INSTDIR\zertis_xamp"  ;Directory copy into
    StrLen $R2 $R1
    GetTempFileName $0
    FileOpen $R3 $0 w
    !insertmacro Locate "$R0" "/L=F" "CallBack"
    FileClose $R3
    IfErrors 0 +2
    MessageBox MB_OK 'error'
    Exec '"notepad.exe" "$0"'     ;view log
SectionEnd  
Function CallBack
    StrCpy $1 $R8 '' $R2
    StrCmp $1 '' +2
    StrCpy $1 '\$1'
    IfFileExists '$R1\$1\*.*' +2
    CreateDirectory '$R1$1'
    CopyFiles /SILENT $R9 '$R1$1'
    ;Your code ...
    ;$R9       "path\name" (source)
    ;$R8       "path"      (source)
    ;$R1$1     "path"      (destination)
    ;$R7       "name"
    IfFileExists '$R1$1\$R7' 0 +3
    FileWrite $R3 "-old:$R9  -new:$R1$1\$R7  -success$\r$\n"
    goto +2
    FileWrite $R3 "-old:$R9  -new:$R1$1\$R7  -failed$\r$\n"
    Push $0
FunctionEnd 
Afrow UK#
I think you're getting mixed with compile time and run time. You want to include (compress) all files in a single folder recursively on compile?

Just use:
File /r "some_local_dir\*.*"

-Stu
jlee#
I O geeze, I thought that a and r had something to do with read and archive. I didn't read it close enough, thanks.
Cerf#
Hello there
I am kind of on the same boat,
The problem is that I am a total newbie to NSIS
I need to get all the files I have in their original dir structure to be copied to Install_Dir\{original structure}

But I am really messed up right now.

Can you help me with that?

Cërf.
Cerf#
Thanks!!!
I knew it had to be very simple, now, is there a way of perform something like that with the delete command? since I don't see /r in the documentation.

Again THANKS!

Cërf.
Cerf#
Once I get this running I think I'm going to write a NSIS 101 tutorial so begginers like me don't have a hard time looking for simple stuff.
: )