MCPcopy Create free account
hub / github.com/celer-pkg/celer / findLatestMSVCVersion

Method findLatestMSVCVersion

configs/toolchain_windows.go:311–330  ·  view source on GitHub ↗
(msvcDir string)

Source from the content-addressed store, hash-verified

309}
310
311func (t Toolchain) findLatestMSVCVersion(msvcDir string) (string, error) {
312 entries, err := os.ReadDir(msvcDir)
313 if err != nil {
314 return "", err
315 }
316
317 var latest string
318 for _, entry := range entries {
319 if entry.IsDir() {
320 name := entry.Name()
321 if latest == "" || t.compareVersion(name, latest) > 0 {
322 latest = name
323 }
324 }
325 }
326 if latest == "" {
327 return "", fmt.Errorf("no MSVC versions found in %s", msvcDir)
328 }
329 return latest, nil
330}
331
332func (t Toolchain) compareVersion(first, second string) int {
333 firstVersion := strings.Split(first, ".")

Callers 1

DetectMethod · 0.95

Calls 2

compareVersionMethod · 0.95
NameMethod · 0.65

Tested by

no test coverage detected