Skip to content

Commit

Permalink
Constant: add BundleForPreset helper
Browse files Browse the repository at this point in the history
This will allow us to get the bundle name as per version and
`GetDefaultBundle` can directly consume it.
  • Loading branch information
praveenkumar committed Sep 19, 2022
1 parent fb451fd commit 9f5c378
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/crc/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func GetAdminHelperURL() string {
return GetAdminHelperURLForOs(runtime.GOOS)
}

func GetDefaultBundle(preset crcpreset.Preset) string {
func BundleForPreset(preset crcpreset.Preset, version string) string {
var bundleName strings.Builder

bundleName.WriteString("crc")
Expand All @@ -107,10 +107,14 @@ func GetDefaultBundle(preset crcpreset.Preset) string {
bundleName.WriteString("_hyperv")
}

fmt.Fprintf(&bundleName, "_%s_%s.crcbundle", version.GetBundleVersion(preset), runtime.GOARCH)
fmt.Fprintf(&bundleName, "_%s_%s.crcbundle", version, runtime.GOARCH)
return bundleName.String()
}

func GetDefaultBundle(preset crcpreset.Preset) string {
return BundleForPreset(preset, version.GetBundleVersion(preset))
}

var (
CrcBaseDir = filepath.Join(GetHomeDir(), ".crc")
crcBinDir = filepath.Join(CrcBaseDir, "bin")
Expand Down

0 comments on commit 9f5c378

Please sign in to comment.