mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Switch to DecodeFile because it's cleaner
This commit is contained in:
parent
2e4ddb667f
commit
db7c837bfa
@ -4,7 +4,6 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@ -33,12 +32,8 @@ type IndexFile struct {
|
||||
|
||||
// LoadIndex attempts to load the index file from a path
|
||||
func LoadIndex(indexFile string, flags Flags) (Index, error) {
|
||||
data, err := ioutil.ReadFile(indexFile)
|
||||
if err != nil {
|
||||
return Index{}, err
|
||||
}
|
||||
var index Index
|
||||
if _, err := toml.Decode(string(data), &index); err != nil {
|
||||
if _, err := toml.DecodeFile(indexFile, &index); err != nil {
|
||||
return Index{}, err
|
||||
}
|
||||
index.flags = flags
|
||||
|
@ -3,7 +3,6 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -27,12 +26,8 @@ type Pack struct {
|
||||
|
||||
// LoadPack loads the modpack metadata to a Pack struct
|
||||
func LoadPack(flags Flags) (Pack, error) {
|
||||
data, err := ioutil.ReadFile(flags.PackFile)
|
||||
if err != nil {
|
||||
return Pack{}, err
|
||||
}
|
||||
var modpack Pack
|
||||
if _, err := toml.Decode(string(data), &modpack); err != nil {
|
||||
if _, err := toml.DecodeFile(flags.PackFile, &modpack); err != nil {
|
||||
return Pack{}, err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user