Added author + pack version (#6)

* Added author + pack version

* Remove unnecessary binary

* Apply suggestions, clean up somewhat

Co-authored-by: comp500 <comp500@users.noreply.github.com>
This commit is contained in:
ThetaDev
2020-11-28 18:10:29 +01:00
committed by GitHub
parent 2ca4ad91f9
commit a87f7b50f0
5 changed files with 90 additions and 62 deletions

View File

@@ -13,16 +13,19 @@ import (
// Pack stores the modpack metadata, usually in pack.toml
type Pack struct {
Name string `toml:"name"`
Index struct {
Name string `toml:"name"`
Author string `toml:"author"`
Version string `toml:"version"`
Index struct {
// Path is stored in forward slash format relative to pack.toml
File string `toml:"file"`
HashFormat string `toml:"hash-format"`
Hash string `toml:"hash"`
} `toml:"index"`
Versions map[string]string `toml:"versions"`
Client map[string]toml.Primitive `toml:"client"`
Server map[string]toml.Primitive `toml:"server"`
Versions map[string]string `toml:"versions"`
Client map[string]toml.Primitive `toml:"client"`
Server map[string]toml.Primitive `toml:"server"`
Export map[string]map[string]interface{} `toml:"export"`
}
// LoadPack loads the modpack metadata to a Pack struct
@@ -105,3 +108,13 @@ func (pack Pack) GetMCVersion() (string, error) {
}
return mcVersion, nil
}
func (pack Pack) GetPackName() string {
if pack.Name == "" {
return "export"
} else if pack.Version == "" {
return pack.Name
} else {
return pack.Name + "-" + pack.Version
}
}