Skip to content

Commit 3b6fcda

Browse files
committed
Update to 1.16
Add workaround for hacky deb package wrapper
1 parent 219db78 commit 3b6fcda

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/shaybox/multimc-curseforge
22

3-
go 1.14
3+
go 1.16
44

5-
require golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b
5+
require golang.org/x/sys v0.0.0-20210309074719-68d13333faf2

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b h1:ggRgirZABFolTmi3sn6Ivd9SipZwLedQ5wR0aAKnFxU=
2-
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1+
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEqqNCi8rreOZnNrbqcIY=
2+
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

main.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ func main() {
7979
}
8080

8181
path = home + "/.local/share/multimc/icons/" + addonInfo.Name
82-
args = []string{"multimc", "--import", pack}
82+
// Workaround for hacky MultiMC.deb package wrapper
83+
deb := "/opt/multimc/run.sh"
84+
if FileExists(deb) {
85+
args = []string{deb, "--import", pack}
86+
} else {
87+
args = []string{"multimc", "--import", pack}
88+
}
8389
case "windows":
8490
executable, err := os.Executable()
8591
if err != nil {
@@ -207,3 +213,13 @@ func RunCMD(args []string) {
207213

208214
cmd.Wait()
209215
}
216+
217+
// FileExists checks if a file exists and is not a directory before we
218+
// try using it to prevent further errors.
219+
func FileExists(filename string) bool {
220+
info, err := os.Stat(filename)
221+
if os.IsNotExist(err) {
222+
return false
223+
}
224+
return !info.IsDir()
225+
}

0 commit comments

Comments
 (0)