From 140e337d5ac4a2d14cec73c60dd6d2eb4311dd77 Mon Sep 17 00:00:00 2001 From: Reece Ward Date: Tue, 12 May 2026 13:14:41 +0100 Subject: [PATCH 1/2] fix: ignore but warn on missing mancpn file --- backend/installfinders/launchers/epic/epic.go | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/backend/installfinders/launchers/epic/epic.go b/backend/installfinders/launchers/epic/epic.go index 1b04c06b..0a41c87b 100644 --- a/backend/installfinders/launchers/epic/epic.go +++ b/backend/installfinders/launchers/epic/epic.go @@ -2,7 +2,9 @@ package epic import ( "encoding/json" + "errors" "fmt" + "log/slog" "os" "path/filepath" @@ -32,6 +34,35 @@ var ( ExperimentalDedicatedServerAppName = "c509233193024c5f8124467d3aa36199" ) +// validateGameManifest cross-checks the .mancpn against the .item manifest. +// Epic may not produce the .mancpn; a missing file is logged and treated as valid. +func validateGameManifest(epicManifest Manifest, platform common.LauncherPlatform) error { + gameManifestName := fmt.Sprintf("%s.mancpn", epicManifest.InstallationGUID) + gameManifestPath := platform.ProcessPath(filepath.Join(epicManifest.ManifestLocation, gameManifestName)) + + gameManifestData, err := os.ReadFile(gameManifestPath) + if errors.Is(err, os.ErrNotExist) { + slog.Info("Epic game manifest not present, skipping cross-validation", slog.String("path", gameManifestPath)) + return nil + } + if err != nil { + return fmt.Errorf("failed to read Epic game manifest %s: %w", gameManifestName, err) + } + + var epicGameManifest GameManifest + if err := json.Unmarshal(gameManifestData, &epicGameManifest); err != nil { + return fmt.Errorf("failed to parse Epic game manifest %s: %w", gameManifestName, err) + } + + if epicGameManifest.CatalogNamespace != epicManifest.CatalogNamespace || + epicGameManifest.CatalogItemID != epicManifest.CatalogItemID || + epicGameManifest.AppName != epicManifest.MainGameAppName { + return fmt.Errorf("mismatching manifest data") + } + + return nil +} + func GetEpicBranch(appName string) (common.GameBranch, error) { switch appName { case EarlyAccessAppName: @@ -86,26 +117,10 @@ func FindInstallationsEpic(epicManifestsPath string, launcher string, platform c installLocation := platform.ProcessPath(epicManifest.InstallLocation) - gameManifestName := fmt.Sprintf("%s.mancpn", epicManifest.InstallationGUID) - gameManifestPath := platform.ProcessPath(filepath.Join(epicManifest.ManifestLocation, gameManifestName)) - gameManifestData, err := os.ReadFile(gameManifestPath) - if err != nil { - findErrors = append(findErrors, fmt.Errorf("failed to read Epic game manifest %s: %w", gameManifestName, err)) - continue - } - - var epicGameManifest GameManifest - if err := json.Unmarshal(gameManifestData, &epicGameManifest); err != nil { - findErrors = append(findErrors, fmt.Errorf("failed to parse Epic game manifest %s: %w", gameManifestName, err)) - continue - } - - if epicGameManifest.CatalogNamespace != epicManifest.CatalogNamespace || - epicGameManifest.CatalogItemID != epicManifest.CatalogItemID || - epicGameManifest.AppName != epicManifest.MainGameAppName { + if err := validateGameManifest(epicManifest, platform); err != nil { findErrors = append(findErrors, common.InstallFindError{ Path: installLocation, - Inner: fmt.Errorf("mismatching manifest data"), + Inner: err, }) continue } From d8306c97e4d9c89bc17383efe5c0e56cb6d28aa6 Mon Sep 17 00:00:00 2001 From: Reece Ward Date: Tue, 12 May 2026 13:25:42 +0100 Subject: [PATCH 2/2] fix: remove the mancpn file checks completely --- backend/installfinders/launchers/epic/epic.go | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/backend/installfinders/launchers/epic/epic.go b/backend/installfinders/launchers/epic/epic.go index 0a41c87b..3b20124f 100644 --- a/backend/installfinders/launchers/epic/epic.go +++ b/backend/installfinders/launchers/epic/epic.go @@ -2,9 +2,7 @@ package epic import ( "encoding/json" - "errors" "fmt" - "log/slog" "os" "path/filepath" @@ -14,19 +12,11 @@ import ( type Manifest struct { CatalogNamespace string `json:"CatalogNamespace"` CatalogItemID string `json:"CatalogItemID"` - ManifestLocation string `json:"ManifestLocation"` - InstallationGUID string `json:"InstallationGUID"` MainGameAppName string `json:"MainGameAppName"` AppVersionString string `json:"AppVersionString"` InstallLocation string `json:"InstallLocation"` } -type GameManifest struct { - AppName string `json:"AppName"` - CatalogNamespace string `json:"CatalogNamespace"` - CatalogItemID string `json:"CatalogItemID"` -} - var ( EarlyAccessAppName = "CrabEA" ExperimentalAppName = "CrabTest" @@ -34,35 +24,6 @@ var ( ExperimentalDedicatedServerAppName = "c509233193024c5f8124467d3aa36199" ) -// validateGameManifest cross-checks the .mancpn against the .item manifest. -// Epic may not produce the .mancpn; a missing file is logged and treated as valid. -func validateGameManifest(epicManifest Manifest, platform common.LauncherPlatform) error { - gameManifestName := fmt.Sprintf("%s.mancpn", epicManifest.InstallationGUID) - gameManifestPath := platform.ProcessPath(filepath.Join(epicManifest.ManifestLocation, gameManifestName)) - - gameManifestData, err := os.ReadFile(gameManifestPath) - if errors.Is(err, os.ErrNotExist) { - slog.Info("Epic game manifest not present, skipping cross-validation", slog.String("path", gameManifestPath)) - return nil - } - if err != nil { - return fmt.Errorf("failed to read Epic game manifest %s: %w", gameManifestName, err) - } - - var epicGameManifest GameManifest - if err := json.Unmarshal(gameManifestData, &epicGameManifest); err != nil { - return fmt.Errorf("failed to parse Epic game manifest %s: %w", gameManifestName, err) - } - - if epicGameManifest.CatalogNamespace != epicManifest.CatalogNamespace || - epicGameManifest.CatalogItemID != epicManifest.CatalogItemID || - epicGameManifest.AppName != epicManifest.MainGameAppName { - return fmt.Errorf("mismatching manifest data") - } - - return nil -} - func GetEpicBranch(appName string) (common.GameBranch, error) { switch appName { case EarlyAccessAppName: @@ -117,14 +78,6 @@ func FindInstallationsEpic(epicManifestsPath string, launcher string, platform c installLocation := platform.ProcessPath(epicManifest.InstallLocation) - if err := validateGameManifest(epicManifest, platform); err != nil { - findErrors = append(findErrors, common.InstallFindError{ - Path: installLocation, - Inner: err, - }) - continue - } - existingIdx := -1 for i := range installs { if installs[i].Path == installLocation {