1; example2.nsi
2;
3; This script is based on example1.nsi, but it remember the directory,
4; has uninstall support and (optionally) installs start menu shortcuts.
5;
6; It will install makensisw.exe into a directory that the user selects,
7
8;--------------------------------
9
10; The name of the installer
11Name "Meeting Recorder"
12
13; The file to write
14OutFile "sphinx3.5_win32.exe"
15
16; The default installation directory
17InstallDir "$PROGRAMFILES\Carnegie Mellon University\Sphinx3.5\"
18
19Var DATADIR
20
21;--------------------------------
22
23; Pages
24
25Page directory
26
27PageEx directory
28	PageCallbacks CheckSettings "" VerifyDD
29PageExEnd
30
31Page instfiles
32
33;--------------------------------
34
35; The stuff to install
36Section "Sphinx Install"
37
38  SectionIn RO
39
40  ; Set output path to the installation directory.
41  SetOutPath $INSTDIR
42
43  ; Put file there
44  File "..\bin\Debug\decode.exe"
45  File "..\bin\Debug\gausubvq.exe"
46  File "..\bin\Debug\livedecode.exe"
47  File "..\bin\Debug\livepretend.exe"
48  File "..\bin\Debug\align.exe"
49  File "..\bin\Debug\allphone.exe"
50  File "..\bin\Debug\dag.exe"
51  File "..\bin\Debug\astar.exe"
52
53
54SectionEnd
55
56; Optional section (can be disabled by the user)
57Section "Start Menu Shortcuts"
58
59;  CreateDirectory "$SMPROGRAMS\Sphinx"
60  CreateShortCut "$SMPROGRAMS\Sphinx.lnk" "$INSTDIR\sphinx.exe" "" "$INSTDIR\sphinx.exe" 0
61
62SectionEnd
63
64;check for an old installation
65Function CheckSettings
66
67  CreateDirectory $INSTDIR
68  ifFileExists "$INSTDIR\settings.txt" has_settings no_settings
69  has_settings:
70    FileOpen $0 "$INSTDIR\settings.txt" r
71    FileRead $0 $R0
72    FileClose $0
73
74    ;strip newline
75    StrLen $R1 $R0
76    IntOp $R1 $R1 - 1
77    StrCpy $DATADIR $R0 $R1
78
79    Goto out
80  no_settings:
81    StrCpy $DATADIR "$INSTDIR"
82
83  out:
84FunctionEnd
85
86Function VerifyDD
87  StrCmp $DATADIR "" p_abort
88  ifFileExists "$DATADIR\*.*" f_end
89
90
91  p_abort:
92  MessageBox MB_OK "$DATADIR\*.*"
93  Abort
94  f_end:
95FunctionEnd
96
97;--------------------------------
98
99