Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow updating of an existing installation #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions FreenetInstall_InnoSetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions translations/Messages_en.isl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions translations/Messages_en_utf8.isl
Original file line number Diff line number Diff line change
Expand Up @@ -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.