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

# · Unknown · 290 lines · 270 code · 20 blank · 0 comment · 0 complexity · a43486123719954be94f317b706313c3 MD5 · raw file

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