Skip to content

Commit

Permalink
Check against factorio_version field when validating base version
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
raiguard committed Feb 11, 2024
1 parent b8ae8b1 commit 50e96b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,16 @@ type PortalModRelease struct {
}

func (r *PortalModRelease) compatibleWithBaseVersion(baseVersion *Version) bool {
if r.InfoJson.FactorioVersion[0] != baseVersion[0] || r.InfoJson.FactorioVersion[1] != baseVersion[1] {
return false
}

for _, dep := range r.InfoJson.Dependencies {
if dep.Name == "base" {
if dep.Version == nil {
return true
}
// Ensure that the Factorio versions match up as well
return baseVersion[0] == dep.Version[0] && baseVersion[1] == dep.Version[1] && dep.Test(baseVersion)
return dep.Test(baseVersion)
}
}
return true
Expand Down
7 changes: 4 additions & 3 deletions lib/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ func releaseFromFile(path string) (*Release, error) {
}

type infoJson struct {
Dependencies []*Dependency `json:"dependencies"`
Name string `json:"name"`
Version Version `json:"version"`
Dependencies []*Dependency `json:"dependencies"`
Name string `json:"name"`
Version Version `json:"version"`
FactorioVersion Version `json:"factorio_version"`
}

func isSymlink(info os.FileInfo) bool {
Expand Down

0 comments on commit 50e96b6

Please sign in to comment.