Archive: Files wont get installed.


Files wont get installed.
  What I am trying to achieve.
I have an installer that installs 5 files at 1 place and 1 file at an another place. (C:\ProgramData\Data Access Worldwide\Visual Report Writer\2.1\) & (C:\ProgramData\Data Access Worldwide\Visual Report Writer\2.1\Data)

If the windows is vista or higher, if the windows is XP then it should install all the files at 1 place.(C:\Program Files\Data Access Worldwide\Visual Report Writer\2.1)

This is what I tried but it does not install any files, I assume I am doing something completely wrong but I can't figure out what..


.


; HM NIS Edit Wizard helper defines
>!define PRODUCT_NAME "Visual Report Writer Developer Deployment"
>!define PRODUCT_VERSION "2.1"
>!define PRODUCT_PUBLISHER "DataAccess"
>!define PRODUCT_WEB_SITE "http://www.dataaccess.com"
>!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
>!define PRODUCT_UNINST_ROOT_KEY "HKLM"
>!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

>; MUI 1.67 compatible ------
!include "MUI.nsh"
>!include "LogicLib.nsh"
>!include "WinVer.nsh"
>!include "x64.nsh"

>; MUI Settings
>!define MUI_ABORTWARNING
>!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
>!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

>; Welcome page
>!insertmacro MUI_PAGE_WELCOME
>; License page
>!insertmacro MUI_PAGE_LICENSE "License Agreement.txt"
>; Directory page
>!insertmacro MUI_PAGE_DIRECTORY
>; Start menu page
>var ICONS_GROUP
>!define MUI_STARTMENUPAGE_NODISABLE
>!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Visual Report Writer Developer Deployment"
>!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
>!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
>!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
>!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
>; Instfiles page
>!insertmacro MUI_PAGE_INSTFILES
>; Finish page
>!insertmacro MUI_PAGE_FINISH

>; Uninstaller pages
>!insertmacro MUI_UNPAGE_INSTFILES

>; Language files
>!insertmacro MUI_LANGUAGE "English"

>;Directories
>;!define Dir1 "C:\ProgramData\Data Access Worldwide\Visual Report Writer\2.1\Data\"
;!define Dir2 "
C:Program FilesData Access WorldwideVisual Report Writer2.1"
;!define Dir3 "C:Program Files(x86)Data Access WorldwideVisual Report Writer2.1"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "C:ProgramDataData Access WorldwideVisual Report Writer2.1"
ShowInstDetails show
ShowUnInstDetails show

Section "-RuntimeFiles64" SEC01
StrCpy $INSTDIR "C:ProgramDataData Access WorldwideVisual Report Writer2.1Data"
SetOverwrite ifnewer
File "Installation FilesVisual Report Writer 2012 Developer Edition API.ocx"
File "Installation Fileslanguage.db"
File "Installation FilesDynapdf.dll"
File "Installation FilesDfapi30.dll"
File "Installation FilesDf_collate.cfg"

; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section "-RuntimeFiles32" SEC02
StrCpy $INSTDIR "C:Program Files(x86)Data Access WorldwideVisual Report Writer2.1"
SetOverwrite ifnewer
File "Installation FilesVisual Report Writer 2012 Developer Edition API.ocx"
File "Installation Fileslanguage.db"
File "Installation FilesDynapdf.dll"
File "Installation FilesDfapi30.dll"
File "Installation FilesDf_collate.cfg"

; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section "-VRW.DB XP" SEC03
StrCpy $INSTDIR "C:Program FilesData Access WorldwideVisual Report Writer2.1"
File "Installation Filesvrw.db"
SectionEnd

Section "-VRW.DB NOTXP" SEC04
StrCpy $INSTDIR "C:ProgramDataData Access WorldwideVisual Report Writer2.1Data"
File "Installation Filesvrw.db"
SectionEnd

Section -AdditionalIcons
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS$ICONS_GROUPUninstall.lnk" "$INSTDIRuninst.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -Post
WriteUninstaller "$INSTDIRuninst.exe"
SectionEnd

Function .onInit
; IfFileExists "C:ProgramDataData Access WorldwideVisual Report Writer2.1Data*.*" +3 0
; MessageBox MB_OK "Directory does not exists and will now be created."
; CreateDirectory "C:ProgramDataData Access WorldwideVisual Report Writer2.1Data"

${If} ${IsWinXP}
${AndIfNot} ${RunningX64} #32 bit
!insertmacro UnselectSection ${SEC01}
!insertmacro SelectSection ${SEC02}
!insertmacro UnselectSection ${SEC04}
!insertmacro SelectSection ${SEC03}
MessageBox MB_OK "Windows XP"

IfFileExists "C:Program FilesData Access WorldwideVisual Report Writer2.1*.*" +3 0
MessageBox MB_OK "Directory does not exists and will now be created."
CreateDirectory "C:Program FilesData Access WorldwideVisual Report Writer2.1"
${ElseIf} ${AtleastWinVista}
${AndIf} ${RunningX64}
!insertmacro UnselectSection ${SEC02}
!insertmacro SelectSection ${SEC01}
!insertmacro UnselectSection ${SEC03}
!insertmacro SelectSection ${SEC04}
MessageBox MB_OK "Windows Vista or higher 64 Bit"

IfFileExists "C:Program Files (x86)Data Access WorldwideVisual Report Writer2.1*.*" +3 0
MessageBox MB_OK "Directory does not exists and will now be created."
CreateDirectory "C:Program Files (x86)Data Access WorldwideVisual Report Writer2.1"
${Else} # Vista or higher 32 bit
!insertmacro UnselectSection ${SEC02}
!insertmacro SelectSection ${SEC01}
!insertmacro UnselectSection ${SEC03}
!insertmacro SelectSection ${SEC04}
MessageBox MB_OK "Windows Vista or higher 32 Bit"

IfFileExists "C:Program FilesData Access WorldwideVisual Report Writer2.1*.*" +3 0
MessageBox MB_OK "Directory does not exists and will now be created."
CreateDirectory "C:Program FilesData Access WorldwideVisual Report Writer2.1"
${EndIf}
FunctionEnd

Function .onInstSuccess
Exec 'C:\Windows\System32\regsvr32.exe /i "Visual Report Writer 2012 Developer Edition API.ocx"'
FunctionEnd

Function un.onUninstSuccess
Exec 'C:\Windows\System32\regsvr32.exe /u "Visual Report Writer 2012 Developer Edition API.ocx"'
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIRuninst.exe"
Delete "$INSTDIRDf_collate.cfg"
Delete "$INSTDIRDfapi30.dll"
Delete "$INSTDIRDynapdf.dll"
Delete "$INSTDIRVisual Report Writer 2012 Developer Edition API.ocx"
Delete "$INSTDIRlanguage.db"
Delete "$INSTDIRvrw.db"

Delete "$SMPROGRAMS$ICONS_GROUPUninstall.lnk"

RMDir "$SMPROGRAMS$ICONS_GROUP"
RMDir "$INSTDIR"

SetAutoClose true
SectionEnd
>

You don't have RequestExecutionLevel in your script.

You should not hard-code paths, use $ProgramFiles, $windir etc


Originally posted by Anders
You don't have RequestExecutionLevel in your script.
Didn't do anything extra, still doesn't copy anything.

Originally posted by Anders
You should not hard-code paths, use $ProgramFiles, $windir etc
Paths are correct, this is how my boss want it to be.

Originally posted by thaman667
Didn't do anything extra, still doesn't copy anything.
Did you set it to requestexecutionlevel admin?

Originally posted by thaman667
Paths are correct, this is how my boss want it to be.
Your boss is most probably wrong. The name "program files" is different on different language versions of Windows. Even if you're only deploying on English Windows versions, users can change the location of program files. Some Windows installs don't even have a C drive.

(Other explanation: You're developing an installer for a Windows application. If that application insists on using c:\Program Files, it is not a valid Windows application and is therefore broken. If you want to use Windows, you need to use it the way it was meant to be used. Otherwise, use a different OS.)

[QUOTE=Paths are correct, this is how my boss want it to be.[/QUOTE]

So if someone has these directories on the D drive you are screwed. Just because your boss doesn't know the right way to do this doesn't mean you should do it wrong.


Corrected the paths and its still not working :\


Like I said.

Originally posted by MSG
Did you set it to requestexecutionlevel admin?