mirror of
https://github.com/packwiz/packwiz.git
synced 2025-11-02 03:24:32 +01:00
WIP: misc fixes, start updating CF/MR export to use download system
This commit is contained in:
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -355,6 +356,20 @@ func (in Index) GetAllMods() []string {
|
||||
return list
|
||||
}
|
||||
|
||||
// LoadAllMods reads all metadata files into Mod structs
|
||||
func (in Index) LoadAllMods() ([]*Mod, error) {
|
||||
modPaths := in.GetAllMods()
|
||||
mods := make([]*Mod, len(modPaths))
|
||||
for i, v := range modPaths {
|
||||
modData, err := LoadMod(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read metadata file %s: %w", v, err)
|
||||
}
|
||||
mods[i] = &modData
|
||||
}
|
||||
return mods, nil
|
||||
}
|
||||
|
||||
// GetFilePath attempts to get the path of the destination index file as it is stored on disk
|
||||
func (in Index) GetFilePath(f IndexFile) string {
|
||||
return filepath.Join(filepath.Dir(in.indexFile), filepath.FromSlash(f.File))
|
||||
|
||||
Reference in New Issue
Block a user