Archive: Win Xp $SYSDIR fails but full path OK


Win Xp $SYSDIR fails but full path OK
Hi

I have just started usiing NSIS and all going well with main files until I tried to use
$SYSDIR for 2 files in the System32 folder.


SetOutPath "$SYSDIR"
StrCpy $INSTDIR $SYSDIR
File "$INSTDIR\CNTRL32.dll"

Got compile error below :-

File: "$INSTDIR\CNTRL32.dll" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Program Files\ITP\DevaMC2008.nsi" on line 77 -- aborting creation process


Used a message box to output $SYSDIR and got :-

c:\windows\system32

Replaced $INSTDIR with full path as below and got no complie errors and
the file is installed correctly.

SetOutPath "$SYSDIR"
StrCpy $INSTDIR $SYSDIR
File "c:\windows\system32\CNTRL32.dll"

I have searched the net and this forum but no solution, has anyone got any ideas?

Full nsi file below

Mike

Command line:
"C:\Program Files\NSIS\makensis.exe" /NOTIFYHWND 132394 "C:\Program Files\ITP\DevaMC2008.nsi"

MakeNSIS v2.46 - Copyright 1995-2009 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config:
Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
- AdvSplash::show
- Banner::destroy
- Banner::getWindow
- Banner::show
- BgImage::AddImage
- BgImage::AddText
- BgImage::Clear
- BgImage::Destroy
- BgImage::Redraw
- BgImage::SetBg
- BgImage::SetReturn
- BgImage::Sound
- Dialer::AttemptConnect
- Dialer::AutodialHangup
- Dialer::AutodialOnline
- Dialer::AutodialUnattended
- Dialer::GetConnectedState
- InstallOptions::dialog
- InstallOptions::initDialog
- InstallOptions::show
- LangDLL::LangDialog
- Math::Script
- NSISdl::download
- NSISdl::download_quiet
- Splash::show
- StartMenu::Init
- StartMenu::Select
- StartMenu::Show
- System::Alloc
- System::Call
- System::Copy
- System::Free
- System::Get
- System::Int64Op
- System::Store
- TypeLib::GetLibVersion
- TypeLib::Register
- TypeLib::UnRegister
- UserInfo::GetAccountType
- UserInfo::GetName
- UserInfo::GetOriginalAccountType
- VPatch::GetFileCRC32
- VPatch::GetFileMD5
- VPatch::vpatchfile
- nsDialogs::Create
- nsDialogs::CreateControl
- nsDialogs::CreateItem
- nsDialogs::CreateTimer
- nsDialogs::GetUserData
- nsDialogs::KillTimer
- nsDialogs::OnBack
- nsDialogs::OnChange
- nsDialogs::OnClick
- nsDialogs::OnNotify
- nsDialogs::SelectFileDialog
- nsDialogs::SelectFolderDialog
- nsDialogs::SetRTL
- nsDialogs::SetUserData
- nsDialogs::Show
- nsExec::Exec
- nsExec::ExecToLog
- nsExec::ExecToStack

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "C:\Program Files\ITP"

Processing script file: "C:\Program Files\ITP\DevaMC2008.nsi"
!define: "PRODUCT_NAME"="DevaMC2008"
!define: "PRODUCT_VERSION"="11.12.8"
!define: "PRODUCT_PUBLISHER"="ITP Group"
!define: "PRODUCT_WEB_SITE"="http://www.itpgroup.co.uk"
!define: "PRODUCT_DIR_REGKEY"="Software\Microsoft\Windows\CurrentVersion\App Paths\DevaMC2008.exe"
!include: "C:\Program Files\NSIS\Include\Library.nsh"
!include: closed: "C:\Program Files\NSIS\Include\Library.nsh"
!include: "C:\Program Files\NSIS\Include\UpgradeDLL.nsh"
!define: "UPGRADEDLL_INCLUDED"=""
!include: closed: "C:\Program Files\NSIS\Include\UpgradeDLL.nsh"
!include: "C:\Program Files\NSIS\Include\MUI2.nsh"
!include: "C:\Program Files\NSIS\Contrib\Modern UI 2\MUI2.nsh"
NSIS Modern User Interface version 2.0 - Copyright 2002-2009 Joost Verburg (C:\Program Files\NSIS\Contrib\Modern UI 2\MUI2.nsh:8)
!define: "MUI_INCLUDED"=""
!define: "MUI_SYSVERSION"="2.0"
!define: "MUI_VERBOSE"="3"
!include: closed: "C:\Program Files\NSIS\Contrib\Modern UI 2\MUI2.nsh"
!include: closed: "C:\Program Files\NSIS\Include\MUI2.nsh"
!define: "MUI_ABORTWARNING"=""
!define: "MUI_ICON"="..\..\AxelRelease\icon00.ico"
!insertmacro: MUI_PAGE_WELCOME
!insertmacro: end of MUI_PAGE_WELCOME
!insertmacro: MUI_PAGE_LICENSE
!insertmacro: end of MUI_PAGEDECLARATION_LICENSE
!insertmacro: end of MUI_PAGE_LICENSE
!insertmacro: MUI_PAGE_COMPONENTS
!insertmacro: end of MUI_PAGE_COMPONENTS
!insertmacro: MUI_PAGE_INSTFILES
!insertmacro: end of MUI_PAGE_INSTFILES
!define: "MUI_FINISHPAGE_RUN"="$INSTDIR\DevaMC2008.exe"
!insertmacro: MUI_PAGE_FINISH
!insertmacro: end of MUI_PAGE_FINISH
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
Name: "DevaMC2008 11.12.8"
OutFile: "C:\AxelRelease\extra32\interface\ITPDEVAMC2008\SetupDevaMC.exe"
InstallDir: "$PROGRAMFILES\itp"
InstallRegKey: "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\DevaMC2008.exe\"
ShowInstDetails: show
Section: "MainSection" ->(SEC01)
SetShellVarContext: all
Var: "HKLM_ITP"
Var: "SERIAL_NUMBER"
Var: "INI_PATH"
StrCpy $HKLM_ITP "Software\ITP Group" () ()
ReadRegStr $SERIAL_NUMBER HKLM\$HKLM_ITP\Serial Number
StrCpy $INI_PATH "$INSTDIR\$SERIAL_NUMBER" () ()
SetOutPath: "$INSTDIR"
SetOverwrite: ifnewer
File: "DevaMC2008.exe" [compress] 922556/3139584 bytes
CreateDirectory: "$SMPROGRAMS\ITP Group"
CreateShortCut: "$SMPROGRAMS\ITP Group\DevaMC2008.lnk"->"$INSTDIR\DevaMC2008.exe" icon:,0, showmode=0x0, hotkey=0x0, comment=
CreateShortCut: "$DESKTOP\DevaMC2008.lnk"->"$INSTDIR\DevaMC2008.exe" icon:,0, showmode=0x0, hotkey=0x0, comment=
SetOutPath: "$INSTDIR\Help\DevaMC2008"
File: "DevaMC2008-CN.chm" [compress] 688402/694995 bytes
File: "DevaMC2008-EN.chm" [compress] 1197352/1203204 bytes
SetOutPath: "$INSTDIR\Lang\DevaMC"
File: "DevaMC2008_English.txt" [compress] 5403/25820 bytes
File: "DevaMC2008_Chinese.txt" [compress] 5429/19546 bytes
SetOutPath: "$INSTDIR"
File: "XpiEditor.exe" [compress] 69996/168960 bytes
CreateShortCut: "$SMPROGRAMS\ITP Group\XpiEditor.lnk"->"$INSTDIR\XpiEditor.exe" icon:,0, showmode=0x0, hotkey=0x0, comment=
File: "FifoPlot.exe" [compress] 31141/94208 bytes
File: "PMD-1208-FS.EXE" [compress] 263063/819200 bytes
File: "PMD_1208_FS.chm" [compress] 189887/197675 bytes
CreateShortCut: "$SMPROGRAMS\ITP Group\PMD-1208-FS.lnk"->"$INSTDIR\PMD-1208-FS.exe" icon:,0, showmode=0x0, hotkey=0x0, comment=
File: "PMDZERO.exe" [compress] 8029/24576 bytes
CreateShortCut: "$SMPROGRAMS\Startup\PMDZERO.lnk"->"$INSTDIR\PMDZERO.exe" icon:,0, showmode=0x0, hotkey=0x0, comment=
SetOutPath: "$SYSDIR"
StrCpy $INSTDIR "$SYSDIR" () ()
File: "$INSTDIR\CNTRL32.dll" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Program Files\ITP\DevaMC2008.nsi" on line 77 -- aborting creation process


Please either use pastebin or an attachment to share huge amounts of code.

Your mistake is simple: $SYSDIR and $INSTDIR are runtime variables. The File command is a compiletime command, so $SYSDIR and $INSTDIR do not have any value yet. The path parameter of File should point at where the file is on your development computer, not on the computer of whoever will be running your installer.


Use $%windir%


Thanks Anders

Sorted now