Add another return type to tools.RemoveMod

This commit is contained in:
rainyuu 2021-01-31 12:26:41 +01:00
parent 222fa543b5
commit fa4aeeb406
2 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,10 @@ func RemoveMod(pkg string) {
buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... ")) buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... "))
if tools.RemoveMod(tools.ExposeModString(pkg)) == 1 { status := tools.RemoveMod(tools.ExposeModString(pkg))
if status == 2 {
buffer += red("mod not found")
} else if status == 1 {
buffer += red("not installed") buffer += red("not installed")
} else { } else {
buffer += blue("uninstalled") buffer += blue("uninstalled")

View File

@ -81,12 +81,13 @@ func DownloadMod(depString string) (int, string, []string) {
} }
// RemoveMod uninstalls a mod // RemoveMod uninstalls a mod
// RemoveMod returns 2 if the mod string was not found, 1 if the mod isn't installed and 0 on success
func RemoveMod(depString string) int { func RemoveMod(depString string) int {
// fmt.Println(depString) // fmt.Println(depString)
status, mod := api.GetModData(depString) status, mod := api.GetModData(depString)
// fmt.Println(mod) // fmt.Println(mod)
if status != 0 { if status != 0 {
return 1 return 2
} }
modFolder := utils.SystemInfo.PluginDir + "/" + depString + "-" + mod.Versions[0].VersionNumber modFolder := utils.SystemInfo.PluginDir + "/" + depString + "-" + mod.Versions[0].VersionNumber