Fixed a few errors

This commit is contained in:
endigma 2021-01-31 13:21:56 -04:00
parent 0788aca862
commit ef4c683ed1
2 changed files with 11 additions and 7 deletions

View File

@ -29,21 +29,24 @@ func InstallMod(pkg string) {
buffer += blue("downloaded") buffer += blue("downloaded")
} }
fmt.Println(deps)
dependencies := []string{} dependencies := []string{}
for _, d := range deps { for _, d := range deps {
dependency := tools.ExposeModString(d) dependency := tools.ExposeModString(d)
// Prevents duplication within this install, overall duplication would require a buffer
if !utils.ExistsInArray(dependencies, d) { if !utils.ExistsInArray(dependencies, d) {
if dependency != "bbepis-BepInExPack" && dependency != "tristanmcpherson-R2API" { if dependency != "bbepis-BepInExPack" && dependency != "tristanmcpherson-R2API" {
dependencies = append(dependencies, d) dependencies = append(dependencies, dependency)
} }
} }
} }
fmt.Println(buffer)
fmt.Println("> Resolving dependencies...")
for _, d := range dependencies { for _, d := range dependencies {
InstallMod(d) InstallMod(d)
} }
fmt.Println(buffer)
} }
// RemoveMod is a CLI frontend for tools.RemoveMod // RemoveMod is a CLI frontend for tools.RemoveMod

View File

@ -34,6 +34,11 @@ func DownloadMod(depString string) (int, string, []string) {
if status != 0 { if status != 0 {
return 3, "not_found", deps return 3, "not_found", deps
} }
for _, dep := range mod.Versions[0].Dependencies {
deps = append(deps, dep)
}
downloadURL := mod.Versions[0].DownloadURL downloadURL := mod.Versions[0].DownloadURL
modName := sysinfo.ProgDir + "/dl/" + depString + ".zip" modName := sysinfo.ProgDir + "/dl/" + depString + ".zip"
@ -66,10 +71,6 @@ func DownloadMod(depString string) (int, string, []string) {
log.Println(unzip) log.Println(unzip)
utils.CheckErr(err) utils.CheckErr(err)
for _, dep := range mod.Versions[0].Dependencies {
deps = append(deps, dep)
}
return status, modver, deps return status, modver, deps
} }