mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 21:16:30 +02:00
Fix paths in index querying
This commit is contained in:
parent
5c82486016
commit
7880488bf1
@ -276,9 +276,21 @@ func (in Index) FindMod(modName string) (string, bool) {
|
|||||||
_, file := filepath.Split(v.File)
|
_, file := filepath.Split(v.File)
|
||||||
fileTrimmed := strings.TrimSuffix(file, ModExtension)
|
fileTrimmed := strings.TrimSuffix(file, ModExtension)
|
||||||
if fileTrimmed == modName {
|
if fileTrimmed == modName {
|
||||||
return v.File, true
|
return filepath.Join(filepath.Dir(in.indexFile), filepath.FromSlash(v.File)), true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllMods finds paths to every metadata file (Mod) in the index
|
||||||
|
func (in Index) GetAllMods() []string {
|
||||||
|
var list []string
|
||||||
|
baseDir := filepath.Dir(in.indexFile)
|
||||||
|
for _, v := range in.Files {
|
||||||
|
if v.MetaFile {
|
||||||
|
list = append(list, filepath.Join(baseDir, filepath.FromSlash(v.File)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
7
main.go
7
main.go
@ -147,10 +147,8 @@ func cmdUpdate(flags core.Flags, mod string) error {
|
|||||||
|
|
||||||
updaterMap := make(map[string][]core.Mod)
|
updaterMap := make(map[string][]core.Mod)
|
||||||
fmt.Println("Reading mod files...")
|
fmt.Println("Reading mod files...")
|
||||||
for _, v := range index.Files {
|
for _, v := range index.GetAllMods() {
|
||||||
if v.MetaFile {
|
modData, err := core.LoadMod(v)
|
||||||
// TODO: check fromslash stuff aaa
|
|
||||||
modData, err := core.LoadMod(v.File)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error reading mod file: %s", err.Error())
|
fmt.Printf("Error reading mod file: %s", err.Error())
|
||||||
continue
|
continue
|
||||||
@ -173,7 +171,6 @@ func cmdUpdate(flags core.Flags, mod string) error {
|
|||||||
fmt.Printf("A supported update system for \"%s\" cannot be found.", modData.Name)
|
fmt.Printf("A supported update system for \"%s\" cannot be found.", modData.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println("Checking for updates...")
|
fmt.Println("Checking for updates...")
|
||||||
updatesFound := false
|
updatesFound := false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user