more error checking on modpack downloads
This commit is contained in:
parent
e7f8de116e
commit
4a35078f90
@ -485,7 +485,11 @@ outer:
|
|||||||
func (i *InstanceManager) ImportModpack(modpack Modpack, name string) {
|
func (i *InstanceManager) ImportModpack(modpack Modpack, name string) {
|
||||||
i.app.Status(fmt.Sprintf("Downloading %s", modpack.Name))
|
i.app.Status(fmt.Sprintf("Downloading %s", modpack.Name))
|
||||||
buff := new(bytes.Buffer)
|
buff := new(bytes.Buffer)
|
||||||
HttpDownload(filepath.Join(modpack.Id, modpack.Versions[len(modpack.Versions)-1].File), buff, i.app.Ctx)
|
err := HttpDownload(filepath.Join(modpack.Id, modpack.Versions[len(modpack.Versions)-1].File), buff, i.app.Ctx)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Unable to download modpack file: %s\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
i.ImportMrpack(buff, name)
|
i.ImportMrpack(buff, name)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -503,6 +507,7 @@ func (i *InstanceManager) ImportMrpack(data io.Reader, name string) {
|
|||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error unpacking modpack file: %s\n", err)
|
fmt.Printf("Error unpacking modpack file: %s\n", err)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
if entry.Name == "modrinth.index.json" {
|
if entry.Name == "modrinth.index.json" {
|
||||||
i.app.Status("Loading metadata")
|
i.app.Status("Loading metadata")
|
||||||
|
Loading…
Reference in New Issue
Block a user