Skip to content

Commit

Permalink
fix a few issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Mar 1, 2024
1 parent 4630d72 commit 187989d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mrpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type (
FormatVersion int `json:"formatVersion"`
Game string `json:"game"`

VersionId string `json:"versionId`
VersionId string `json:"versionId"`
Name string `json:"name"`
Summary string `json:"summary,optional"`

Expand Down
8 changes: 2 additions & 6 deletions spigot_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ func (*SpigotInstaller) Install(path, name string, target string) (installed str
foundVersion += "(" + target + ")"
}

buildDir, err := os.MkdirTemp("", "spigot-build-")
if err != nil {
return
}
defer os.RemoveAll(buildDir)
buildDir := filepath.Join(os.TempDir(), "server-installer-" + PkgVersion + ".bukkit-build-tools.tmp")
loger.Infof("Getting %q...", SpigotBuildToolsURI)
buildToolJar := filepath.Join(buildDir, "BuildTools.jar")
if err = DefaultHTTPClient.Download(SpigotBuildToolsURI, buildToolJar, 0644, nil, -1,
Expand All @@ -66,7 +62,7 @@ func (*SpigotInstaller) Install(path, name string, target string) (installed str
cmd.Stderr = os.Stdout
loger.Infof("Running %q...", cmd.String())
if err = cmd.Run(); err != nil {
loger.Infof("Build failed. Build log moved to BuildTools.log (if exists)")
loger.Infof("Build failed. Build log (if exists) moved to BuildTools.log")
os.Rename(filepath.Join(buildDir, "BuildTools.log.txt"), "BuildTools.log")
return
}
Expand Down
5 changes: 2 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func checkHashStream(r io.Reader, hashes StringMap, w io.Writer) (n int64, err e
fmt.Printf("err is not nil: %T", err)
return
}
return
for i, h := range hashers {
sum := hex.EncodeToString(h.Sum(nil))
if expect := expects[i]; expect[1] != sum {
Expand Down Expand Up @@ -155,9 +154,9 @@ func formatSize(bytes int64, format string) string {
if b <= 1000 {
break
}
b /= 1000
b /= 1024
}
return fmt.Sprintf(format+"%s", b, unit)
return fmt.Sprintf(format, b) + unit
}

type DlCallback = func(n int64, size int64)
Expand Down

0 comments on commit 187989d

Please sign in to comment.