Archive: automatic files management


automatic files management
well basically i have to make a installer for a package with over 10000 files and 5000 directories

and from wht i have seen to date it seems imposible because i would have to write each file/dir to be copied/created by hand

is there a posiblity to do this automatically ?
if so how


You can extract an entire directory and create all the files and and subdirectories using the File /r command.


i was hoping this would be the cause
i use "File /r C:\sourcedir\*.*" now and works like a charm

however i have a problem with this function i made

; GetGetOs
; Returns on top of stack
; Windows Version (NT, 9X)
; Usage:
; Call GetOs
;at this point $R0 is "NT" or "9X"

Function GetOs
Push $R0
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors lbl_win9x lbl_winnt

lbl_winnt:
StrCpy $R0 "NT"
Goto lbl_done

lbl_win9x:
StrCpy $R0 "9X"
Goto lbl_done

lbl_done:
Exch $R0
FunctionEnd


even when i put
Call GetOs
Push $R0
oninit i stil get a empty $R0 var

It should be Pop $R0, not Push $R0.


thanks guys
you are so fast in replies
nsis is great


now i want to create difetent sections depending on the value of $R0
can i do this ?
!ifdef R0 = "NT" does not seem to work and i dont think it should either


It shouldn't. !ifdef is a compile time directive. Just use StrCmp to execute the right part of the code from the section.


yea sure .. but how
when i use


Function services
StrCmp $R0 "9X" go_9x go_nt
StrCmp $R0 "NT" go_nt go_9x

go_nt:
Goto done
SubSection "Create autostarting services"
Section "Create Apache Service"
SectionEnd
Section "Create Mysql Service"
SectionEnd
Section "Create Xmail Service"
SectionEnd
Section "Create Slimftpd Service"
SectionEnd
SubSectionEnd

go_9x:
Goto done

done:
FunctionEnd

it gives a error about section in function

Sorry, thought you wanted one section to execute different codes. To hide a section use SectionSetText with an empty string. To show a hidden section (defined using Section "" or Section "-name that's not used") use SectionSetText with the name you want shown. Do this in .onInit and you'll have different sections the user can select from in Windows 9x and NT.


yes but from what i read it seems that hidden sections are automatically executed
i want a section to be visible under NT and the user be able to change it but i dont want that section at all under win9x


Then unselect them using SectionSetFlags or just skip them using a simple StrCmp on the top of thier code.