Make sure we do not download R2API, BepInEx or the same dependency multiple times
This commit is contained in:
parent
3a420c4a41
commit
268f1b2e43
5
main.go
5
main.go
@ -75,9 +75,14 @@ func main() {
|
|||||||
for _, m := range os.Args[2:] {
|
for _, m := range os.Args[2:] {
|
||||||
newdeps := cli.InstallMod(m)
|
newdeps := cli.InstallMod(m)
|
||||||
for _, d := range newdeps {
|
for _, d := range newdeps {
|
||||||
|
dependency := tools.ExposeModString(d)
|
||||||
|
if !utils.ExistsInArray(dependencies, d) {
|
||||||
|
if dependency != "bbepis-BepInExPack" && dependency != "tristanmcpherson-R2API" {
|
||||||
dependencies = append(dependencies, d)
|
dependencies = append(dependencies, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
fmt.Println("> Downloading dependencies...")
|
fmt.Println("> Downloading dependencies...")
|
||||||
for _, d := range dependencies {
|
for _, d := range dependencies {
|
||||||
cli.InstallMod(d)
|
cli.InstallMod(d)
|
||||||
|
@ -185,3 +185,13 @@ func DownloadFile(filepath string, url string) error {
|
|||||||
_, err = io.Copy(out, resp.Body)
|
_, err = io.Copy(out, resp.Body)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExistsInArray checks if the given string exists in a string array
|
||||||
|
func ExistsInArray(array []string, search string) bool {
|
||||||
|
for _, i := range array {
|
||||||
|
if i == search {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user