MCPcopy
hub / github.com/spicetify/cli / validateReleaseBuild

Function validateReleaseBuild

src/preprocess/preprocess.go:1074–1095  ·  view source on GitHub ↗
(spotifyBinaryPath string)

Source from the content-addressed store, hash-verified

1072}
1073
1074func validateReleaseBuild(spotifyBinaryPath string) error {
1075 fileContent, err := os.ReadFile(spotifyBinaryPath)
1076 if err != nil {
1077 return fmt.Errorf("could not read %s: %w", filepath.Base(spotifyBinaryPath), err)
1078 }
1079
1080 buildRegex := regexp.MustCompile(`(Master|Release|PR|Local) Build.+(?:cef_)?(\d+\.\d+\.\d+\+g[0-9a-f]+\+chromium-\d+\.\d+\.\d+\.\d+)`)
1081 matches := buildRegex.FindSubmatch(fileContent)
1082
1083 if len(matches) == 0 {
1084 utils.PrintWarning(fmt.Sprintf("Could not detect Spotify build type in %s, skipping validation", filepath.Base(spotifyBinaryPath)))
1085 return nil
1086 }
1087
1088 buildType := string(matches[1])
1089 if buildType != "Release" {
1090 return fmt.Errorf("detected %s Spotify build! spicetify works only on Release builds. Please install latest Release version of Spotify", buildType)
1091 }
1092
1093 utils.PrintSuccess(fmt.Sprintf("Spotify's build type is %s. Continuing...", string(matches[1])))
1094 return nil
1095}
1096
1097type githubRelease = utils.GithubRelease
1098

Callers 1

StartFunction · 0.85

Calls 2

PrintWarningFunction · 0.92
PrintSuccessFunction · 0.92

Tested by

no test coverage detected