GODT-1977: fix launcher for v2 to v3 updates.

This commit is contained in:
Jakub
2022-11-03 14:01:26 +01:00
committed by James Houlahan
parent 34213d1607
commit c08d0eff7a
8 changed files with 79 additions and 17 deletions

View File

@ -25,6 +25,7 @@ import (
"github.com/Masterminds/semver/v3"
"github.com/ProtonMail/proton-bridge/v2/internal/versioner"
"github.com/sirupsen/logrus"
)
type InstallerDefault struct {
@ -40,3 +41,15 @@ func NewInstaller(versioner *versioner.Versioner) *InstallerDefault {
func (i *InstallerDefault) InstallUpdate(version *semver.Version, r io.Reader) error {
return i.versioner.InstallNewVersion(version, r)
}
func (i *InstallerDefault) IsAlreadyInstalled(version *semver.Version) bool {
versions, err := i.versioner.ListVersions()
if err != nil {
logrus.WithField("version", version).
WithError(err).Error("Failed to determine whether version is installed")
return false
}
return versions.HasVersion(version)
}