Make sure we do not download R2API, BepInEx or the same dependency multiple times
This commit is contained in:
		
							parent
							
								
									3a420c4a41
								
							
						
					
					
						commit
						268f1b2e43
					
				
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							| @ -75,7 +75,12 @@ func main() { | ||||
| 		for _, m := range os.Args[2:] { | ||||
| 			newdeps := cli.InstallMod(m) | ||||
| 			for _, d := range newdeps { | ||||
| 				dependencies = append(dependencies, d) | ||||
| 				dependency := tools.ExposeModString(d) | ||||
| 				if !utils.ExistsInArray(dependencies, d) { | ||||
| 					if dependency != "bbepis-BepInExPack" && dependency != "tristanmcpherson-R2API" { | ||||
| 						dependencies = append(dependencies, d) | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		fmt.Println("> Downloading dependencies...") | ||||
|  | ||||
| @ -185,3 +185,13 @@ func DownloadFile(filepath string, url string) error { | ||||
| 	_, err = io.Copy(out, resp.Body) | ||||
| 	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