Skip to content

Commit

Permalink
Update to 1.16
Browse files Browse the repository at this point in the history
Add workaround for hacky deb package wrapper
  • Loading branch information
ShayBox committed May 18, 2021
1 parent 219db78 commit 3b6fcda
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/shaybox/multimc-curseforge

go 1.14
go 1.16

require golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b
require golang.org/x/sys v0.0.0-20210309074719-68d13333faf2
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b h1:ggRgirZABFolTmi3sn6Ivd9SipZwLedQ5wR0aAKnFxU=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEqqNCi8rreOZnNrbqcIY=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
18 changes: 17 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ func main() {
}

path = home + "/.local/share/multimc/icons/" + addonInfo.Name
args = []string{"multimc", "--import", pack}
// Workaround for hacky MultiMC.deb package wrapper
deb := "/opt/multimc/run.sh"
if FileExists(deb) {
args = []string{deb, "--import", pack}
} else {
args = []string{"multimc", "--import", pack}
}
case "windows":
executable, err := os.Executable()
if err != nil {
Expand Down Expand Up @@ -207,3 +213,13 @@ func RunCMD(args []string) {

cmd.Wait()
}

// FileExists checks if a file exists and is not a directory before we
// try using it to prevent further errors.
func FileExists(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
return !info.IsDir()
}

0 comments on commit 3b6fcda

Please sign in to comment.