1 | ; |
---|
2 | ; File produced by the obuild tool version 1.0 |
---|
3 | ; for the package osc_snovis with version v1r0. |
---|
4 | ; |
---|
5 | ; Input file for the Inno Setup tool to create an install wizard. |
---|
6 | ; |
---|
7 | ; Usage : |
---|
8 | ; ( DOS> set PATH to access the Inno Setup Compil32 program ) |
---|
9 | ; DOS> cd <path>\osc_snovis\v1r0\obuild |
---|
10 | ; DOS> Compil32 DOS\this.iss |
---|
11 | ; Click on Build to create the : |
---|
12 | ; osc_snovis-v1r0-WindowsXP-VC71.exe |
---|
13 | ; file. |
---|
14 | ; |
---|
15 | |
---|
16 | [LangOptions] |
---|
17 | LanguageName=English |
---|
18 | LanguageID=$0409 |
---|
19 | DialogFontName=MS Shell Dlg |
---|
20 | DialogFontSize=10 |
---|
21 | TitleFontName=Arial |
---|
22 | TitleFontSize=29 |
---|
23 | WelcomeFontName=Verdana |
---|
24 | WelcomeFontSize=14 |
---|
25 | CopyrightFontName=Arial |
---|
26 | CopyrightFontSize=10 |
---|
27 | |
---|
28 | [Setup] |
---|
29 | AppName=osc_snovis |
---|
30 | AppId=osc_snovis |
---|
31 | AppVerName=osc_snovis v1r0 |
---|
32 | AppCopyright=Copyright (C) 2001-2005 Guy Barrand |
---|
33 | AppPublisher=LAL, Universite Paris-Sud, Batiment 200, 91898 Orsay cedex, France |
---|
34 | AppPublisherURL=http://OpenScientist.lal.in2p3.fr |
---|
35 | AppVersion=v1r0 |
---|
36 | UsePreviousAppDir=1 |
---|
37 | UsePreviousGroup=1 |
---|
38 | DefaultDirName={pf}\osc_snovis\v1r0 |
---|
39 | DefaultGroupName=osc_snovis |
---|
40 | BackColor=$FF0000 |
---|
41 | BackColor2=$0F0F00 |
---|
42 | BackColorDirection=toptobottom |
---|
43 | WindowShowCaption=yes |
---|
44 | WindowStartMaximized=no |
---|
45 | WindowVisible=1 |
---|
46 | WindowResizable=1 |
---|
47 | UninstallDisplayName=osc_snovis v1r0 |
---|
48 | UninstallLogMode=Append |
---|
49 | DirExistsWarning=auto |
---|
50 | CreateUninstallRegKey=1 |
---|
51 | UninstallFilesDir={app}\uninst_exe |
---|
52 | DisableDirPage=0 |
---|
53 | DisableStartupPrompt=1 |
---|
54 | CreateAppDir=1 |
---|
55 | DisableProgramGroupPage=0 |
---|
56 | Uninstallable=1 |
---|
57 | UninstallDisplayIcon={app}\icon\uninlandaq.ico |
---|
58 | ReserveBytes=0 |
---|
59 | UseSetupLdr=1 |
---|
60 | ; SourceDir is relative to where the .iss is. |
---|
61 | SourceDir=.. |
---|
62 | OutputDir=. |
---|
63 | OutputBaseFilename=osc_snovis-v1r0-WindowsXP-VC71 |
---|
64 | InfoBeforeFile=.\release\InnoSetup\info_before.txt |
---|
65 | RestartIfNeededByRun=yes |
---|
66 | |
---|
67 | [Types] |
---|
68 | Name: Run_Time_Kit; Description: Typical installation |
---|
69 | |
---|
70 | [Components] |
---|
71 | Name: RTK; Description: The run time kit; Types: Run_Time_Kit ; Flags : fixed |
---|
72 | |
---|
73 | |
---|
74 | [Files] |
---|
75 | ; Applications, DLLS, Python modules : |
---|
76 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\bin\*.exe;DestDir:{app}\bin;Components:RTK |
---|
77 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\bin\*.dll;DestDir:{app}\bin;Components:RTK |
---|
78 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\bin\*.pyd;DestDir:{app}\bin;Components:RTK |
---|
79 | ; Libraries : |
---|
80 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\lib\*.lib;DestDir:{app}\lib;Components:RTK |
---|
81 | ; Resources : |
---|
82 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\Resources\*.*;DestDir:{app}\Resources;Components:RTK;Flags:recursesubdirs |
---|
83 | ; Else : |
---|
84 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\README;DestDir:{app};Components:RTK |
---|
85 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\License;DestDir:{app};Components:RTK |
---|
86 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\*.bat;DestDir:{app};Components:RTK |
---|
87 | Source:..\Windows_NT_obuild\osc_snovis\v1r0\bin\*.save;DestDir:{app}\bin;Components:RTK |
---|
88 | |
---|
89 | [_ISTool] |
---|
90 | EnableISX=true |
---|
91 | UseAbsolutePaths=false |
---|
92 | Use7zip=false |
---|
93 | |
---|
94 | [Code] |
---|
95 | // ----------------------------------------------------------------- |
---|
96 | // code for changing PATH |
---|
97 | // ----------------------------------------------------------------- |
---|
98 | |
---|
99 | // |
---|
100 | // Inno Setup Extensions Knowledge Base |
---|
101 | // Article 44 - Native ISX procedures for PATH modification |
---|
102 | // http://www13.brinkster.com/vincenzog/isxart.asp?idart=44 |
---|
103 | // Author: Thomas Vedel |
---|
104 | // |
---|
105 | |
---|
106 | // Version log: |
---|
107 | // 03/31/2003: Initial release (thv@lr.dk) |
---|
108 | |
---|
109 | const |
---|
110 | // Modification method |
---|
111 | pmAddToBeginning = $1; // Add dir to beginning of Path |
---|
112 | pmAddToEnd = $2; // Add dir to end of Path |
---|
113 | pmAddAllways = $4; // Add also if specified dir is already included in existing path |
---|
114 | pmAddOnlyIfDirExists = $8; // Add only if specified dir actually exists |
---|
115 | pmRemove = $10; // Remove dir from path |
---|
116 | pmRemoveSubdirsAlso = $20; // Remove dir and all subdirs from path |
---|
117 | |
---|
118 | // Scope |
---|
119 | psCurrentUser = 1; // Modify path for current user |
---|
120 | psAllUsers = 2; // Modify path for all users |
---|
121 | |
---|
122 | // Error results |
---|
123 | mpOK = 0; // No errors |
---|
124 | mpMissingRights = -1; // User has insufficient rights |
---|
125 | mpAutoexecNoWriteacc = -2; // Autoexec can not be written (may be readonly) |
---|
126 | mpBothAddAndRemove = -3; // User has specified that dir should both be removed from and added to path |
---|
127 | |
---|
128 | |
---|
129 | { Helper procedure: Split a path environment variable into individual dirnames } |
---|
130 | procedure SplitPath(Path: string; var Dirs: TStringList); |
---|
131 | var |
---|
132 | pos: integer; |
---|
133 | s: string; |
---|
134 | begin |
---|
135 | Dirs.Clear; |
---|
136 | s := ''; |
---|
137 | pos := 1; |
---|
138 | while (pos<=Length(Path)) do |
---|
139 | begin |
---|
140 | if (Path[pos]<>';') then |
---|
141 | s := s + Path[pos]; |
---|
142 | if ((Path[pos]=';') or (pos=Length(Path))) then |
---|
143 | begin |
---|
144 | s := Trim(s); |
---|
145 | s := RemoveQuotes(s); |
---|
146 | s := Trim(s); |
---|
147 | if (s <> '') then |
---|
148 | Dirs.Add(s); |
---|
149 | s := ''; |
---|
150 | end; |
---|
151 | Pos := Pos + 1; |
---|
152 | end; |
---|
153 | end; // procedure SplitPath |
---|
154 | |
---|
155 | |
---|
156 | { Helper procedure: Concatenate individual dirnames into a path environment variable } |
---|
157 | procedure ConcatPath(Dirs: TStringList; Quotes: boolean; var Path: string); |
---|
158 | var |
---|
159 | Index, MaxIndex: integer; |
---|
160 | s: string; |
---|
161 | begin |
---|
162 | MaxIndex := Dirs.Count-1; |
---|
163 | Path := ''; |
---|
164 | for Index := 0 to MaxIndex do |
---|
165 | begin |
---|
166 | s := Dirs.Strings[Index]; |
---|
167 | if ((Quotes) and (pos(' ',s) > 0)) then |
---|
168 | s := AddQuotes(s); |
---|
169 | Path := Path + s; |
---|
170 | if (Index < MaxIndex) then |
---|
171 | Path := Path + ';' |
---|
172 | end; |
---|
173 | end; // procedure ConcatPath |
---|
174 | |
---|
175 | |
---|
176 | { Helper function: Modifies path environment string } |
---|
177 | procedure ModifyPathString(OldPath, DirName: string; Method: integer; Quotes: boolean; var ResultPath: string); |
---|
178 | var |
---|
179 | Dirs: TStringList; |
---|
180 | DirNotInPath: Boolean; |
---|
181 | i: integer; |
---|
182 | begin |
---|
183 | // Create Dirs variable |
---|
184 | Dirs := TStringList.Create; |
---|
185 | |
---|
186 | // Remove quotes form DirName |
---|
187 | DirName := Trim(DirName); |
---|
188 | DirName := RemoveQuotes(DirName); |
---|
189 | DirName := Trim(DirName); |
---|
190 | |
---|
191 | // Split old path in individual directory names |
---|
192 | SplitPath(OldPath, Dirs); |
---|
193 | |
---|
194 | // Check if dir is allready in path |
---|
195 | DirNotInPath := True; |
---|
196 | for i:=Dirs.Count-1 downto 0 do |
---|
197 | begin |
---|
198 | if (uppercase(Dirs.Strings[i]) = uppercase(DirName)) then |
---|
199 | DirNotInPath := False; |
---|
200 | end; |
---|
201 | |
---|
202 | // Should dir be removed from existing Path? |
---|
203 | if ((Method and (pmRemove or pmRemoveSubdirsAlso)) > 0) then |
---|
204 | begin |
---|
205 | for i:=Dirs.Count-1 downto 0 do |
---|
206 | begin |
---|
207 | if (((Method and pmRemoveSubdirsAlso) > 0) and (pos(uppercase(DirName)+'\', uppercase(Dirs.Strings[i])) = 1)) or |
---|
208 | (((Method and (pmRemove) or (pmRemoveSubdirsAlso)) > 0) and (uppercase(DirName) = uppercase(Dirs.Strings[i]))) |
---|
209 | then |
---|
210 | Dirs.Delete(i); |
---|
211 | end; |
---|
212 | end; |
---|
213 | |
---|
214 | // Should dir be added to existing Path? |
---|
215 | if ((Method and (pmAddToBeginning or pmAddToEnd)) > 0) then |
---|
216 | begin |
---|
217 | // Add dir to path |
---|
218 | if (((Method and pmAddAllways) > 0) or DirNotInPath) then |
---|
219 | begin |
---|
220 | // Dir is not in path allready or should be added anyway |
---|
221 | if (((Method and pmAddOnlyIfDirExists) = 0) or (DirExists(DirName))) then |
---|
222 | begin |
---|
223 | // Dir actually exsists or should be added anyway |
---|
224 | if ((Method and pmAddToBeginning) > 0) then |
---|
225 | Dirs.Insert(0, DirName) |
---|
226 | else |
---|
227 | Dirs.Append(DirName); |
---|
228 | end; |
---|
229 | end; |
---|
230 | end; |
---|
231 | |
---|
232 | // Concatenate directory names into one single path variable |
---|
233 | ConcatPath(Dirs, Quotes, ResultPath); |
---|
234 | // Finally free Dirs object |
---|
235 | Dirs.Free; |
---|
236 | end; // ModifyPathString |
---|
237 | |
---|
238 | |
---|
239 | { Helper function: Modify path on Windows 9x } |
---|
240 | function ModifyPath9x(DirName: string; Method: integer): integer; |
---|
241 | var |
---|
242 | AutoexecLines: TStringList; |
---|
243 | ActualLine: String; |
---|
244 | PathLineNos: TStringList; |
---|
245 | FirstPathLineNo: Integer; |
---|
246 | OldPath, ResultPath: String; |
---|
247 | LineNo, CharNo, Index: integer; |
---|
248 | |
---|
249 | TempString: String; |
---|
250 | begin |
---|
251 | // Expect everything to be OK |
---|
252 | result := mpOK; |
---|
253 | |
---|
254 | // Create stringslists |
---|
255 | AutoexecLines := TStringList.Create; |
---|
256 | PathLineNos := TStringList.Create; |
---|
257 | |
---|
258 | // Read existing path |
---|
259 | OldPath := ''; |
---|
260 | LoadStringFromFile('c:\Autoexec.bat', TempString); |
---|
261 | AutoexecLines.Text := TempString; |
---|
262 | PathLineNos.Clear; |
---|
263 | // Read Autoexec line by line |
---|
264 | for LineNo := 0 to AutoexecLines.Count - 1 do begin |
---|
265 | ActualLine := AutoexecLines.Strings[LineNo]; |
---|
266 | // Check if line starts with "PATH=" after first stripping spaces and other "fill-chars" |
---|
267 | if Pos('=', ActualLine) > 0 then |
---|
268 | begin |
---|
269 | for CharNo := Pos('=', ActualLine)-1 downto 1 do |
---|
270 | if (ActualLine[CharNo]=' ') or (ActualLine[CharNo]=#9) then |
---|
271 | Delete(ActualLine, CharNo, 1); |
---|
272 | if Pos('@', ActualLine) = 1 then |
---|
273 | Delete(ActualLine, 1, 1); |
---|
274 | if (Pos('PATH=', uppercase(ActualLine))=1) or (Pos('SETPATH=', uppercase(ActualLine))=1) then |
---|
275 | begin |
---|
276 | // Remove 'PATH=' and add path to "OldPath" variable |
---|
277 | Delete(ActualLine, 1, pos('=', ActualLine)); |
---|
278 | // Check if an earlier PATH variable is referenced, but there has been no previous PATH defined in Autoexec |
---|
279 | if (pos('%PATH%',uppercase(ActualLine))>0) and (PathLineNos.Count=0) then |
---|
280 | OldPath := ExpandConstant('{win}') + ';' + ExpandConstant('{win}')+'\COMMAND'; |
---|
281 | if (pos('%PATH%',uppercase(ActualLine))>0) then |
---|
282 | begin |
---|
283 | ActualLine := Copy(ActualLine, 1, pos('%PATH%',uppercase(ActualLine))-1) + |
---|
284 | OldPath + |
---|
285 | Copy(ActualLine, pos('%PATH%',uppercase(ActualLine))+6, Length(ActualLine)); |
---|
286 | end; |
---|
287 | OldPath := ActualLine; |
---|
288 | |
---|
289 | // Update list of line numbers holding path variables |
---|
290 | PathLineNos.Add(IntToStr(LineNo)); |
---|
291 | end; |
---|
292 | end; |
---|
293 | end; |
---|
294 | |
---|
295 | // Save first line number in Autoexec.bat which modifies path environment variable |
---|
296 | if PathLineNos.Count > 0 then |
---|
297 | FirstPathLineNo := StrToInt(PathLineNos.Strings[0]) |
---|
298 | else |
---|
299 | FirstPathLineNo := 0; |
---|
300 | |
---|
301 | // Modify path |
---|
302 | ModifyPathString(OldPath, DirName, Method, True, ResultPath); |
---|
303 | |
---|
304 | // Write Modified path back to Autoexec.bat |
---|
305 | // First delete all existing path references from Autoexec.bat |
---|
306 | Index := PathLineNos.Count-1; |
---|
307 | while (Index>=0) do |
---|
308 | begin |
---|
309 | AutoexecLines.Delete(StrToInt(PathLineNos.Strings[Index])); |
---|
310 | Index := Index-1; |
---|
311 | end; |
---|
312 | // Then insert new path variable into Autoexec.bat |
---|
313 | AutoexecLines.Insert(FirstPathLineNo, '@PATH='+ResultPath); |
---|
314 | // Delete old Autoexec.bat from disk |
---|
315 | if not DeleteFile('c:\Autoexec.bat') then |
---|
316 | result := mpAutoexecNoWriteAcc; |
---|
317 | Sleep(500); |
---|
318 | // And finally write Autoexec.bat back to disk |
---|
319 | if not (result=mpAutoexecNoWriteAcc) then |
---|
320 | SaveStringToFile('c:\Autoexec.bat', AutoexecLines.Text, false); |
---|
321 | |
---|
322 | // Free stringlists |
---|
323 | PathLineNos.Free; |
---|
324 | AutoexecLines.Free; |
---|
325 | end; // ModifyPath9x |
---|
326 | |
---|
327 | |
---|
328 | { Helper function: Modify path on Windows NT, 2000 and XP } |
---|
329 | function ModifyPathNT(DirName: string; Method, Scope: integer): integer; |
---|
330 | var |
---|
331 | RegRootKey: integer; |
---|
332 | RegSubKeyName: string; |
---|
333 | RegValueName: string; |
---|
334 | OldPath, ResultPath: string; |
---|
335 | OK: boolean; |
---|
336 | begin |
---|
337 | // Expect everything to be OK |
---|
338 | result := mpOK; |
---|
339 | |
---|
340 | // Initialize registry key and value names to reflect if changes should be global or local to current user only |
---|
341 | case Scope of |
---|
342 | psCurrentUser: |
---|
343 | begin |
---|
344 | RegRootKey := HKEY_CURRENT_USER; |
---|
345 | RegSubKeyName := 'Environment'; |
---|
346 | RegValueName := 'Path'; |
---|
347 | end; |
---|
348 | psAllUsers: |
---|
349 | begin |
---|
350 | RegRootKey := HKEY_LOCAL_MACHINE; |
---|
351 | RegSubKeyName := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; |
---|
352 | RegValueName := 'Path'; |
---|
353 | end; |
---|
354 | end; |
---|
355 | |
---|
356 | // Read current path value from registry |
---|
357 | OK := RegQueryStringValue(RegRootKey, RegSubKeyName, RegValueName, OldPath); |
---|
358 | if not OK then |
---|
359 | begin |
---|
360 | result := mpMissingRights; |
---|
361 | Exit; |
---|
362 | end; |
---|
363 | |
---|
364 | // Modify path |
---|
365 | ModifyPathString(OldPath, DirName, Method, False, ResultPath); |
---|
366 | |
---|
367 | // Write new path value to registry |
---|
368 | if not RegWriteStringValue(RegRootKey, RegSubKeyName, RegValueName, ResultPath) then |
---|
369 | begin |
---|
370 | result := mpMissingRights; |
---|
371 | Exit; |
---|
372 | |
---|
373 | end; |
---|
374 | end; // ModifyPathNT |
---|
375 | |
---|
376 | |
---|
377 | { Main function: Modify path } |
---|
378 | function ModifyPath(Path: string; Method, Scope: integer): integer; |
---|
379 | begin |
---|
380 | // Check if both add and remove has been specified (= error!) |
---|
381 | if (Method and (pmAddToBeginning or pmAddToEnd) and (pmRemove or pmRemoveSubdirsAlso)) > 0 then |
---|
382 | begin |
---|
383 | result := mpBothAddAndRemove; |
---|
384 | Exit; |
---|
385 | end; |
---|
386 | |
---|
387 | // Perform directory constant expansion |
---|
388 | Path := ExpandConstantEx(Path, ' ', ' '); |
---|
389 | |
---|
390 | // Test if Win9x |
---|
391 | if InstallOnThisVersion('4,0','0,0') = irInstall then |
---|
392 | ModifyPath9x(Path, Method); |
---|
393 | |
---|
394 | // Test if WinNT, 2000 or XP |
---|
395 | if InstallOnThisVersion('0,4','0,0') = irInstall then |
---|
396 | ModifyPathNT(Path, Method, Scope); |
---|
397 | end; // ModifyPath |
---|
398 | |
---|
399 | |
---|
400 | |
---|
401 | |
---|
402 | // ----------------------------------------------------------------- |
---|
403 | // install script hooks |
---|
404 | // ----------------------------------------------------------------- |
---|
405 | |
---|
406 | procedure SetupPATH; |
---|
407 | var |
---|
408 | p : string; |
---|
409 | scope : integer; |
---|
410 | begin |
---|
411 | p:= ExpandConstant('{app}\bin'); |
---|
412 | if IsAdminLoggedOn then |
---|
413 | scope:= psAllUsers |
---|
414 | else |
---|
415 | scope:= psCurrentUser; |
---|
416 | ModifyPath(p, pmAddToEnd, scope); |
---|
417 | end; |
---|
418 | |
---|
419 | procedure InstallSetupPath; |
---|
420 | begin |
---|
421 | // if ShouldProcessEntry('', 'addpath') = srYes then |
---|
422 | SetupPATH; |
---|
423 | end; |
---|