Skip to content

Commit 04155e7

Browse files
committed
fix: check for both dll and exe on windows
1 parent 4097185 commit 04155e7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/preprocess/preprocess.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,17 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
119119
var spotifyBinaryPath string
120120
switch runtime.GOOS {
121121
case "windows":
122-
spotifyBinaryPath = filepath.Join(spotifyBasePath, "spotify.dll")
122+
dllPath := filepath.Join(spotifyBasePath, "spotify.dll")
123+
exePath := filepath.Join(spotifyBasePath, "spotify.exe")
124+
125+
if _, err := os.Stat(dllPath); err == nil {
126+
spotifyBinaryPath = dllPath
127+
} else if _, err := os.Stat(exePath); err == nil {
128+
spotifyBinaryPath = exePath
129+
} else {
130+
utils.PrintError("Could not find spotify.dll or spotify.exe in Spotify installation directory")
131+
utils.Fatal(errors.New("aborting the patching process due to missing Spotify binaries"))
132+
}
123133
case "darwin":
124134
spotifyBinaryPath = filepath.Join(spotifyBasePath, "..", "MacOS", "Spotify")
125135
}
@@ -1043,11 +1053,12 @@ func validateReleaseBuild(spotifyBinaryPath string) error {
10431053
return fmt.Errorf("could not read %s: %w", filepath.Base(spotifyBinaryPath), err)
10441054
}
10451055

1046-
buildRegex := regexp.MustCompile(`(Master|Release|PR|Local) Build.+(cef_\d+\.\d+\.\d+\+g[0-9a-f]+\+chromium-\d+\.\d+\.\d+\.\d+)`)
1056+
buildRegex := regexp.MustCompile(`(Master|Release|PR|Local) Build.+(?:cef_)?(\d+\.\d+\.\d+\+g[0-9a-f]+\+chromium-\d+\.\d+\.\d+\.\d+)`)
10471057
matches := buildRegex.FindSubmatch(fileContent)
10481058

10491059
if len(matches) == 0 {
1050-
return fmt.Errorf("could not detect Spotify build type in %s", filepath.Base(spotifyBinaryPath))
1060+
utils.PrintWarning(fmt.Sprintf("Could not detect Spotify build type in %s, skipping validation", filepath.Base(spotifyBinaryPath)))
1061+
return nil
10511062
}
10521063

10531064
buildType := string(matches[1])

0 commit comments

Comments
 (0)