diff --git a/FreenetInstall_InnoSetup.iss b/FreenetInstall_InnoSetup.iss index 9de4109..839bc0f 100644 --- a/FreenetInstall_InnoSetup.iss +++ b/FreenetInstall_InnoSetup.iss @@ -300,3 +300,22 @@ begin if (PageID = JavaDependency.Page.ID) And fCheckJavaInstall() then Result := True; if (PageID = NetDependency.Page.ID) And IsNetInstalled() then Result := True; end; + +function IsFreenetInstalled(): Boolean; +var + RegPath: String; +begin + Result := False; + RegPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); + if RegValueExists(HKLM, RegPath, 'UninstallString') or RegValueExists(HKCU, RegPath, 'UninstallString') + then Result := True; +end; + +function InitializeSetup(): Boolean; +begin + Result := True; + if (IsFreenetInstalled()) then begin + Result := False; + MsgBox(CustomMessage('FreenetAlreadyInstalled'), mbCriticalError, MB_OK); + end; +end; diff --git a/translations/Messages_en.isl b/translations/Messages_en.isl index c4b04c4..7d8833f 100644 --- a/translations/Messages_en.isl +++ b/translations/Messages_en.isl @@ -8,6 +8,7 @@ DependencyInstalled=%1 has been installed on your system. ErrorLaunchDependencyInstaller=Can't launch %1 installer.%n%nError (%2): %3. AdditionalOptions=Additional options: StartFreenetWithWindows=Start Freenet when I log in to Windows +FreenetAlreadyInstalled=An existing Freenet installation is found. This installer cannot be used to update Freenet to a newer version. To update, enable Freenet's built-in automatic updates or run 'update.cmd' from the installation directory. To re-install, please uninstall Freenet first. [Messages] WelcomeLabel2=This will install [name/ver] on your computer. diff --git a/translations/Messages_en_utf8.isl b/translations/Messages_en_utf8.isl index c49b859..1299cc7 100644 --- a/translations/Messages_en_utf8.isl +++ b/translations/Messages_en_utf8.isl @@ -8,6 +8,7 @@ DependencyInstalled=%1 has been installed on your system. ErrorLaunchDependencyInstaller=Can't launch %1 installer.%n%nError (%2): %3. AdditionalOptions=Additional options: StartFreenetWithWindows=Start Freenet when I log in to Windows +FreenetAlreadyInstalled=An existing Freenet installation is found. This installer cannot be used to update Freenet to a newer version. To update, enable Freenet's built-in automatic updates or run 'update.cmd' from the installation directory. To re-install, please uninstall Freenet first. [Messages] WelcomeLabel2=This will install [name/ver] on your computer.