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

@ -50,6 +50,16 @@ func (v Versions) Swap(i, j int) {
v[i], v[j] = v[j], v[i]
}
func (v Versions) HasVersion(want *semver.Version) bool {
for i := range v {
if v[i].version.Equal(want) {
return true
}
}
return false
}
func (v *Version) String() string {
return fmt.Sprintf("%v", v.version)
}
@ -101,13 +111,7 @@ func (v *Version) VerifyFiles(kr *crypto.KeyRing) error {
// GetExecutable returns the full path to the executable of the given version.
// It returns an error if the executable is missing or does not have executable permissions set.
func (v *Version) GetExecutable(name string) (string, error) {
exe := filepath.Join(v.path, getExeName(name))
if !fileExists(exe) || !fileIsExecutable(exe) {
return "", ErrNoExecutable
}
return exe, nil
return getExecutableInDirectory(name, v.path)
}
// Remove removes this version directory.