PageRenderTime 558ms CodeModel.GetById 30ms app.highlight 96ms RepoModel.GetById 1ms app.codeStats 1ms

/jEdit/tags/jedit-4-3-pre5/package-files/windows/win32installer.iss

#
Unknown | 291 lines | 271 code | 20 blank | 0 comment | 0 complexity | c8a7698b67dbb63ae4d56aac75b970c0 MD5 | raw file
  1; Inno Setup installer script for jEdit
  2; Björn "Vampire" Kautler <Vampire@jEdit.org>
  3;
  4
  5[Setup]
  6AppName=jEdit
  7AppVerName=jEdit @jedit.version@
  8AppPublisher=Slava Pestov and others
  9AppPublisherURL=http://www.jEdit.org
 10AppSupportURL=http://www.jEdit.org
 11AppUpdatesURL=http://www.jEdit.org
 12DefaultDirName={pf}\jEdit
 13DefaultGroupName=jEdit
 14AllowNoIcons=true
 15LicenseFile=@dist.dir@\doc\COPYING.txt
 16OutputDir=@dist.dir@
 17OutputBaseFilename=@win.filename@
 18SetupIconFile=@base.dir@\icons\jedit.ico
 19Compression=lzma
 20SolidCompression=true
 21SourceDir=@dist.dir@
 22VersionInfoVersion=@jedit.build.number@
 23VersionInfoCompany=Slava Pestov and others
 24VersionInfoDescription=Programmer's Text Editor
 25VersionInfoTextVersion=@jedit.version@
 26VersionInfoCopyright=Copyright Š 1998-@current.year@ Slava Pestov
 27ShowLanguageDialog=yes
 28AppCopyright=Copyright Š 1998-@current.year@ Slava Pestov
 29ChangesAssociations=true
 30TimeStampsInUTC=true
 31FlatComponentsList=false
 32ShowTasksTreeLines=true
 33WindowShowCaption=false
 34WindowResizable=false
 35WindowVisible=true
 36AppVersion=@jedit.version@
 37AppID={{10B7DCF9-FD90-4063-82B7-91C174D47338}
 38UninstallDisplayName=jEdit @jedit.version@
 39AppContact=devel@jEdit.org
 40AppReadmeFile={app}\doc\README.txt
 41UninstallDisplayIcon={app}\jedit.ico
 42ChangesEnvironment=true
 43PrivilegesRequired=admin
 44WizardImageFile=@base.dir@\icons\WindowsInstallerImage.bmp
 45WizardSmallImageFile=@base.dir@\icons\WindowsInstallerSmallImage.bmp
 46
 47[Languages]
 48Name: english; MessagesFile: compiler:Default.isl
 49Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
 50Name: catalan; MessagesFile: compiler:Languages\Catalan.isl
 51Name: czech; MessagesFile: compiler:Languages\Czech.isl
 52Name: danish; MessagesFile: compiler:Languages\Danish.isl
 53Name: dutch; MessagesFile: compiler:Languages\Dutch.isl
 54Name: finnish; MessagesFile: compiler:Languages\Finnish.isl
 55Name: french; MessagesFile: compiler:Languages\French.isl
 56Name: german; MessagesFile: compiler:Languages\German.isl
 57Name: hungarian; MessagesFile: compiler:Languages\Hungarian.isl
 58Name: italian; MessagesFile: compiler:Languages\Italian.isl
 59Name: norwegian; MessagesFile: compiler:Languages\Norwegian.isl
 60Name: polish; MessagesFile: compiler:Languages\Polish.isl
 61Name: portuguese; MessagesFile: compiler:Languages\Portuguese.isl
 62Name: russian; MessagesFile: compiler:Languages\Russian.isl
 63Name: slovak; MessagesFile: compiler:Languages\Slovak.isl
 64Name: slovenian; MessagesFile: compiler:Languages\Slovenian.isl
 65
 66[Tasks]
 67Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
 68Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}
 69Name: autostartserver; Description: Start jEdit Server automatically on system startup; GroupDescription: Autostart:; Languages: slovenian slovak russian portuguese polish norwegian italian hungarian french finnish dutch danish czech catalan brazilianportuguese english
 70Name: autostartserver; Description: jEdit Server automatisch beim Hochfahren starten; GroupDescription: Autostart:; Languages: german
 71
 72[Files]
 73Source: @jar.filename@; DestDir: {app}; Flags: ignoreversion sortfilesbyextension; Components: main
 74Source: doc\*; DestDir: {app}\doc; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Excludes: api\*,README.txt; Components: main
 75Source: doc\api\*; DestDir: {app}\doc\api; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Components: apidoc
 76Source: jars\LatestVersion.jar; DestDir: {app}\jars; Flags: ignoreversion sortfilesbyextension; Components: main
 77Source: jars\QuickNotepad.jar; DestDir: {app}\jars; Flags: ignoreversion sortfilesbyextension; Components: main
 78Source: macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Components: macros
 79Source: modes\*; DestDir: {app}\modes; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Components: main
 80Source: properties\*; DestDir: {app}\properties; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Components: main
 81Source: startup\*; DestDir: {app}\startup; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension; Components: main
 82Source: @base.dir@\icons\jedit.ico; DestDir: {app}; Flags: ignoreversion sortfilesbyextension; Components: main
 83Source: doc\README.txt; DestDir: {app}\doc; Flags: isreadme ignoreversion sortfilesbyextension; Components: main
 84Source: classes\package-files\windows\jedit.bat; DestDir: {app}; Flags: ignoreversion sortfilesbyextension; AfterInstall: UpdateBatchfile; Components: batchfile
 85Source: classes\package-files\windows\launchstub.exe; DestDir: {app}; Flags: ignoreversion sortfilesbyextension; Components: batchfile
 86
 87[INI]
 88Filename: {app}\jEdit.url; Section: InternetShortcut; Key: URL; String: http://www.jEdit.org
 89
 90[Icons]
 91Name: {group}\jEdit; Filename: {code:javaPath}; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: jEdit - Programmer's Text Editor; HotKey: ctrl+alt+j; IconIndex: 0; Parameters: "-jar ""{app}\@jar.filename@"" -reuseview"
 92Name: {group}\{cm:ProgramOnTheWeb,jEdit}; Filename: {app}\jEdit.url; Comment: jEdit Website
 93Name: {group}\Start jEdit Server; Filename: {code:javaPath}; Parameters: "-jar ""{app}\@jar.filename@"" -background -nogui"; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: Start jEdit Server; IconIndex: 0; Languages: slovenian slovak russian portuguese polish norwegian italian hungarian french finnish dutch danish czech catalan brazilianportuguese english
 94Name: {group}\Quit jEdit Server; Filename: {code:javaPath}; Parameters: "-jar ""{app}\@jar.filename@"" -quit"; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: Quit jEdit Server; IconIndex: 0; Languages: slovenian slovak russian portuguese polish norwegian italian hungarian french finnish dutch danish czech catalan brazilianportuguese english
 95Name: {group}\jEdit Server Starten; Filename: {code:javaPath}; Parameters: "-jar ""{app}\@jar.filename@"" -background -nogui"; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: jEdit Server Starten; IconIndex: 0; Languages: german
 96Name: {group}\jEdit Server Beenden; Filename: {code:javaPath}; Parameters: "-jar ""{app}\@jar.filename@"" -quit"; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: jEdit Server Beenden; IconIndex: 0; Languages: german
 97Name: {group}\{cm:UninstallProgram,jEdit}; Filename: {uninstallexe}; Comment: {cm:UninstallProgram,jEdit}
 98Name: {userdesktop}\jEdit; Filename: {code:javaPath}; Tasks: desktopicon; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: jEdit - Programmer's Text Editor; IconIndex: 0; Parameters: "-jar ""{app}\@jar.filename@"""
 99Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\jEdit; Filename: {code:javaPath}; Tasks: quicklaunchicon; WorkingDir: {app}; IconFilename: {app}\jedit.ico; Comment: jEdit - Programmer's Text Editor; IconIndex: 0; Parameters: "-jar ""{app}\@jar.filename@"""
100
101[Run]
102Filename: {code:javaPath}; Description: {cm:LaunchProgram,jEdit}; Flags: postinstall skipifsilent nowait; WorkingDir: {app}; Parameters: "-jar ""{app}\@jar.filename@"""
103
104[Components]
105Name: main; Description: jEdit - Programmer's Text Editor; Flags: fixed; Types: custom compact full
106Name: apidoc; Description: API Documentation (for macro and plugin development); Types: custom full
107Name: macros; Description: Default set of macros (highly recommended); Types: custom compact full
108Name: batchfile; Description: Batch file (for command-line usage); Types: custom compact full
109
110[Registry]
111Root: HKCR; Subkey: *\Shell; Flags: uninsdeletekeyifempty
112Root: HKCR; Subkey: *\Shell\Open with jEdit; Flags: uninsdeletekey; Languages: slovenian slovak russian portuguese polish norwegian italian hungarian french finnish dutch danish czech catalan brazilianportuguese english
113Root: HKCR; Subkey: *\Shell\Open with jEdit\Command; ValueType: string; ValueData: """{code:javaPath}"" -jar ""{app}\@jar.filename@"" -reuseview ""%1"""; Flags: uninsdeletekey; Languages: slovenian slovak russian portuguese polish norwegian italian hungarian french finnish dutch danish czech catalan brazilianportuguese english
114Root: HKCR; Subkey: *\Shell\Mit jEdit Öffnen; Flags: uninsdeletekey; Languages: german
115Root: HKCR; Subkey: *\Shell\Mit jEdit Öffnen\Command; ValueType: string; ValueData: """{code:javaPath}"" -jar ""{app}\@jar.filename@"" -reuseview ""%1"""; Flags: uninsdeletekey; Languages: german
116Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueData: """{code:javaPath}"" -jar ""{app}\@jar.filename@"" -background -nogui"; Tasks: autostartserver; ValueName: jEdit Server; Flags: uninsdeletevalue
117
118[UninstallDelete]
119Type: files; Name: {app}\jEdit.url
120
121[Code]
122var
123	javawExePath: String;
124
125// looks for current JRE version, in Registry
126function getJREVersion: String;
127var
128	jreVersion : String;
129begin
130	jreVersion := '';
131	RegQueryStringValue(HKLM,'SOFTWARE\JavaSoft\Java Runtime Environment','CurrentVersion',jreVersion);
132	Result := jreVersion;
133end;
134
135// looks for current JDK version, in Registry
136function getJDKVersion: String;
137var
138	jdkVersion : String;
139begin
140	jdkVersion := '';
141	RegQueryStringValue(HKLM,'SOFTWARE\JavaSoft\Java Development Kit', 'CurrentVersion', jdkVersion);
142	Result := jdkVersion;
143end;
144
145// Finds path to "javaw.exe" by looking up JDK or JRE locations
146// in the registry.  Ensures the file actually exists.  If none
147// is found, an empty string is returned.
148function javaPath(Param: String): String;
149var
150	javaVersion : String;
151	javaHome : String;
152	path : String;
153begin
154	if Length(javawExePath) > 0 then begin
155		Result := javawExePath;
156		exit;
157	end;
158
159	// try to find JRE "javaw.exe"
160	javaVersion := getJREVersion;
161	if (Length(javaVersion) > 0) and (javaVersion >= '1.4') then begin
162		RegQueryStringValue(HKLM,'SOFTWARE\JavaSoft\Java Runtime Environment\' + javaVersion,'JavaHome',javaHome);
163		path := javaHome + '\bin\javaw.exe';
164		if FileExists(path) then begin
165			Log('(JRE) found javaw.exe: ' + path);
166			javawExePath := path;
167			Result := javawExePath;
168			exit;
169		end;
170	end;
171
172	// if we didn't find a JRE "javaw.exe", try for a JDK one
173	Log('(JDK) JRE not found or too old, looking for JDK');
174	javaVersion := getJDKVersion;
175	if (Length(javaVersion) > 0) and (javaVersion >= '1.4') then begin
176		RegQueryStringValue(HKLM,'SOFTWARE\JavaSoft\Java Development Kit\' + javaVersion,'JavaHome',javaHome);
177		path := javaHome + '\bin\javaw.exe';
178		if FileExists(path) then begin
179			Log('(JDK) found javaw.exe: ' + path);
180			javawExePath := path;
181			Result := javawExePath;
182			exit;
183		end;
184	end;
185
186	// we didn't find a suitable "javaw.exe"
187	Result := '';
188end;
189
190// updates the batch file for commandline usage
191// and includes its path in %PATH
192procedure UpdateBatchFile;
193var
194	tmpS : String;
195	tmpSA : Array Of String;
196	i, pathLine : Integer;
197begin
198	LoadStringFromFile(ExpandConstant('{app}\jedit.bat'),tmpS);
199	StringChange(tmpS,'{jedit.jar}','{app}\@jar.filename@');
200	SaveStringToFile(ExpandConstant('{app}\jedit.bat'),ExpandConstantEx(tmpS,'javaw.exe',javaPath('')),false);
201	if UsingWinNT then begin
202		tmpS := '';
203		RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',tmpS);
204		if Pos(Uppercase(ExpandConstant('{app}')),Uppercase(tmpS)) = 0 then begin
205			if not (Copy(tmpS,Length(tmpS),1) = ';') then begin
206				tmpS := tmpS + ';';
207			end;
208			tmpS := tmpS + ExpandConstant('{app}');
209		end;
210		RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',tmpS);
211	end else begin
212		LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),tmpSA);
213		pathLine := -1;
214		for i := 0 to GetArrayLength(tmpSA) - 1 do begin
215			tmpS := Trim(tmpSA[i]);
216			if Uppercase(Copy(tmpS,1,5)) = 'PATH=' then begin
217				pathLine := i;
218				if not (Pos(Uppercase(ExpandConstant('{app}')),Uppercase(tmpS)) = 0) then begin
219					exit;
220				end;
221			end;
222		end;
223		if pathLine = -1 then begin
224			SetArrayLength(tmpSA,GetArrayLength(tmpSA) + 1);
225			tmpSA[GetArrayLength(tmpSA) - 1] := 'PATH=' + ExpandConstant('{app}');
226		end else begin
227			tmpS := Trim(tmpSA[pathLine]);
228			if not (Copy(tmpS,Length(tmpS),1) = ';') then begin
229				tmpS := tmpS + ';';
230			end;
231			tmpSA[pathLine] := tmpS + ExpandConstant('{app}');
232		end;
233		SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),tmpSA,false);
234	end;
235end;
236
237// Called on setup startup
238function InitializeSetup: Boolean;
239begin
240	// check if java >= 1.4 is installed
241	if Length(javaPath('')) > 0 then begin
242		Result := true;
243	end	else begin
244		MsgBox('Setup was unable to find an installed Java Runtime Environment or Java Development Kit of version 1.4, or higher.' + #13 +
245			   'You must have installed at least JDK or JRE 1.4 to continue setup.' + #13 +
246			   'Please install one from http://java.sun.com and restart setup.', mbInformation, MB_OK);
247		Result := false;
248	end;
249end;
250
251// Called on entering a new step while uninstalling
252procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
253var
254	tmpS : String;
255	tmpSA : Array Of String;
256	i, position : Integer;
257begin
258	if CurUninstallStep = usPostUninstall then begin
259		if UsingWinNT then begin
260			tmpS := '';
261			RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',tmpS);
262			position := Pos(Uppercase(ExpandConstant('{app}')),Uppercase(tmpS));
263			if not (position = 0) then begin
264				Delete(tmpS,position,Length(ExpandConstant('{app}')));
265				if Copy(tmpS,position,1) = ';' then begin
266					Delete(tmpS,position,1);
267				end;
268			end;
269			RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',tmpS);
270		end else begin
271			LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),tmpSA);
272			for i := 0 to GetArrayLength(tmpSA) - 1 do begin
273				tmpS := Trim(tmpSA[i]);
274				if Uppercase(Copy(tmpS,1,5)) = 'PATH=' then begin
275					position := Pos(Uppercase(ExpandConstant('{app}')),Uppercase(tmpS));
276					if not (position = 0) then begin
277						Delete(tmpS,position,Length(ExpandConstant('{app}')));
278						if Copy(tmpS,position,1) = ';' then begin
279							Delete(tmpS,position,1);
280						end;
281					end;
282					tmpSA[i] := tmpS;
283				end;
284			end;
285			SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),tmpSA,false);
286		end;
287	end else if CurUninstallStep = usUninstall then begin
288		// Delete Plugins that were downloaded to application directory
289		DelTree(ExpandConstant('{app}\jars'),true,true,true);
290	end;
291end;