In install_vanilla_client() fixed messages.

This commit is contained in:
Alexander Andreev 2024-12-17 19:13:24 +04:00
parent c52bebedf7
commit e23db23eae
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -82,8 +82,8 @@ func (ic *InstallCommand) install_vanilla_client() error {
}
fmt.Printf("Version %s (%s) was chosen.\n", version.Id, version.Type)
fmt.Print("Retrieving a manifest file... ")
manifestPath := path.Join(ic.DestDir, "versions", version.Id, version.Id+".json")
fmt.Print("Retrieving ", path.Join("versions", version.Id, version.Id+".json"), "... ")
data, err = util.LoadOrDownloadFile(manifestPath, version.Url, version.Sha1, "sha1", -1)
if err != nil {
return err
@ -93,21 +93,19 @@ func (ic *InstallCommand) install_vanilla_client() error {
if err != nil {
return err
}
fmt.Println("Done")
if !util.IsFileExist(manifestPath) {
fmt.Print("Writing a manifest file to ", manifestPath, " ... ")
if err := util.WriteFile(manifestPath, data); err != nil {
return err
}
fmt.Println("Done")
} else {
fmt.Println(manifestPath, "does exist. Skipping")
fmt.Println("does exist. Skipping")
}
clientPath := path.Join(ic.DestDir, "versions", manifst.Id, manifst.Id+".jar")
fmt.Print("Retrieving ", path.Join("versions", manifst.Id, manifst.Id+".jar"), "... ")
if !util.IsFileExist(clientPath) {
fmt.Print("Retrieving and writing a client to ", clientPath, " ... ")
data, err = util.LoadOrDownloadFile(clientPath, manifst.Downloads["client"].Url,
manifst.Downloads["client"].Sha1, "sha1", manifst.Downloads["client"].Size)
if err != nil {
@ -118,12 +116,11 @@ func (ic *InstallCommand) install_vanilla_client() error {
}
fmt.Println("Done")
} else {
fmt.Println(clientPath, "does exist. Skipping")
fmt.Println("does exist. Skipping")
}
fmt.Printf("Retrieving an asset index %s.json... ", manifst.AssetIndex.Id)
fmt.Print("Retrieving ", path.Join("assets", "indexes", manifst.AssetIndex.Id+".json"), "... ")
assetIndexPath := path.Join(ic.DestDir, "assets", "indexes", manifst.AssetIndex.Id+".json")
data, err = util.LoadOrDownloadFile(assetIndexPath, manifst.AssetIndex.Url,
manifst.AssetIndex.Sha1, "sha1", manifst.AssetIndex.Size)
if err != nil {
@ -134,16 +131,14 @@ func (ic *InstallCommand) install_vanilla_client() error {
if err != nil {
return err
}
fmt.Println("Done")
if !util.IsFileExist(assetIndexPath) {
fmt.Printf("Writing an asset index %s to %s...", manifst.AssetIndex.Id, assetIndexPath)
if err := util.WriteFile(assetIndexPath, data); err != nil {
return err
}
fmt.Println("Done")
} else {
fmt.Printf("%s does exist. Skip writing\n", assetIndexPath)
fmt.Print("does exist. Skip writing")
}
fmt.Print("Retrieving assets...")
@ -182,8 +177,8 @@ func (ic *InstallCommand) install_vanilla_client() error {
if manifst.Logging.Client.Argument != "" {
logConfPath := path.Join(ic.DestDir, "assets", "log_configs", manifst.Logging.Client.File.Id)
fmt.Print("Retrieving ", path.Join("assets", "log_configs", manifst.Logging.Client.File.Id), "... ")
if !util.IsFileExist(logConfPath) {
fmt.Printf("Retrieving and writing %s...", logConfPath)
data, err = util.LoadOrDownloadFile(logConfPath, manifst.Logging.Client.File.Url,
manifst.Logging.Client.File.Sha1, "sha1", manifst.Logging.Client.File.Size)
if err != nil {