Skip to content

Commit 0405aff

Browse files
committed
Remove MultiMC update wrapper workaround
1 parent d1bbe66 commit 0405aff

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

main.go

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,29 @@ func main() {
6666
fmt.Println("Error occured getting addon info, proceeding")
6767
}
6868

69-
var path string
70-
var args []string
69+
var iconPath string
70+
var execArgs []string
7171
switch runtime.GOOS {
7272
case "darwin":
73-
path = "/Applications/PolyMC.app/Contents/MacOS/icons/" + addonInfo.Name
74-
args = []string{"open", "-a", "PolyMC", "--args", "--import", pack}
73+
execArgs = []string{"open", "-a", "PolyMC", "--args", "--import", pack}
74+
iconPath = "/Applications/PolyMC.app/Contents/MacOS/icons/" + addonInfo.Name
7575
case "freebsd", "linux", "netbsd", "openbsd":
7676
home, err := os.UserHomeDir()
7777
if err != nil {
7878
fmt.Println(err)
7979
}
8080

81-
path = home + "/.local/share/polymc/icons/" + addonInfo.Name
82-
// Workaround for hacky PolyMC.deb package wrapper
83-
deb := "/opt/polymc/run.sh"
84-
if FileExists(deb) {
85-
args = []string{deb, "--import", pack}
86-
} else {
87-
args = []string{"polymc", "--import", pack}
88-
}
81+
execArgs = []string{"polymc", "--import", pack}
82+
iconPath = home + "/.local/share/polymc/icons/" + addonInfo.Name
8983
case "windows":
9084
executable, err := os.Executable()
9185
if err != nil {
9286
fmt.Println(err)
9387
}
9488

95-
polymc := filepath.Dir(executable)
96-
path = polymc + "\\icons\\" + addonInfo.Name
97-
args = []string{"PolyMC.exe", "--import", pack}
89+
execPath := filepath.Dir(executable)
90+
execArgs = []string{"PolyMC.exe", "--import", pack}
91+
iconPath = execPath + "\\icons\\" + addonInfo.Name
9892
}
9993

10094
var attachmentURL string
@@ -105,13 +99,13 @@ func main() {
10599
}
106100
}
107101

108-
err = DownloadFile(path, attachmentURL)
102+
err = DownloadFile(iconPath, attachmentURL)
109103
if err != nil {
110104
fmt.Println(err)
111105
fmt.Println("Error occured downloaading icon, proceeding")
112106
}
113107

114-
RunCMD(args)
108+
RunCMD(execArgs)
115109
}
116110

117111
// LoadXML - Load XML from disk into variable

0 commit comments

Comments
 (0)