Mod metadata retrieval

This commit is contained in:
comp500
2019-05-11 01:43:34 +01:00
parent 6c820a3748
commit 3fdac51d22
3 changed files with 111 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ package core
import (
"crypto/sha256"
"encoding/hex"
"errors"
"io"
"os"
"path/filepath"
@@ -89,3 +90,12 @@ func (pack Pack) Write() error {
return enc.Encode(pack)
}
// GetMCVersion gets the version of Minecraft this pack uses, if it has been correctly specified
func (pack Pack) GetMCVersion() (string, error) {
mcVersion, ok := pack.Versions["minecraft"]
if !ok {
return "", errors.New("No Minecraft version specified in modpack!")
}
return mcVersion, nil
}