From e09f7e7660d280dc0a5305342b71d4ff172536c9 Mon Sep 17 00:00:00 2001 From: Restart Date: Sat, 2 Nov 2024 20:20:41 -0400 Subject: [PATCH] fix bug --- go.mod | 3 ++- go.sum | 8 ++++++++ main.go | 13 ++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index e5ff0bc..61fe1b1 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,10 @@ module github.com/restartfu/simply-portmypack go 1.23.0 -require github.com/restartfu/portmypack v0.0.0-20240901033253-06919fc87ee8 +require github.com/restartfu/portmypack v0.0.2-0.20241103002009-1d57a83ad945 require ( + github.com/gofrs/flock v0.12.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/magiconair/properties v1.8.7 // indirect golang.org/x/sys v0.26.0 // indirect diff --git a/go.sum b/go.sum index ff927eb..a7ca0dc 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,16 @@ +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/restartfu/portmypack v0.0.0-20240901033253-06919fc87ee8 h1:cz5UeCwfmUoSzyXZJQ1snKtQ4lySNkKZmEuJ7uFdz2w= github.com/restartfu/portmypack v0.0.0-20240901033253-06919fc87ee8/go.mod h1:9i7NIJr1W9jm4bRFSuxB/oCa5SNr16twVoLLCauMo8Q= +github.com/restartfu/portmypack v0.0.1 h1:tCEILGaM4buZVOicEYZlxBJrHrDWMHhFQZvZdHNEHvk= +github.com/restartfu/portmypack v0.0.1/go.mod h1:9i7NIJr1W9jm4bRFSuxB/oCa5SNr16twVoLLCauMo8Q= +github.com/restartfu/portmypack v0.0.2-0.20241103001138-53c78de33aed h1:dV8Cuak0buMukYYE/6CTx1I7+dNDfb9BS0JuNLsLNpk= +github.com/restartfu/portmypack v0.0.2-0.20241103001138-53c78de33aed/go.mod h1:9i7NIJr1W9jm4bRFSuxB/oCa5SNr16twVoLLCauMo8Q= +github.com/restartfu/portmypack v0.0.2-0.20241103002009-1d57a83ad945 h1:OWiKJIrDMByAPWWpmPpcUdhh1J43m3XiPzuaRJbKUTM= +github.com/restartfu/portmypack v0.0.2-0.20241103002009-1d57a83ad945/go.mod h1:9i7NIJr1W9jm4bRFSuxB/oCa5SNr16twVoLLCauMo8Q= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/main.go b/main.go index e1d50d8..d756f1f 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,12 @@ package main import ( + "fmt" "golang.org/x/sys/windows" "log" + "math/rand" "os" + "os/exec" "strings" "unsafe" @@ -21,9 +24,13 @@ func main() { log.Fatalln(err) } - cache, _ := os.UserCacheDir() - appdata := cache + "\\Packages\\Microsoft.MinecraftUWP_8wekyb3d8bbwe\\LocalState\\games\\com.mojang\\resource_packs" - portmypack.PortJavaEditionPack(javapack, appdata) + out := fmt.Sprintf("%s\\portmypack-%d.mcpack", os.TempDir(), rand.Int63()) + portmypack.PortJavaEditionPack(javapack, out) + + err = exec.Command("cmd.exe", "/c", out).Run() + if err != nil { + log.Fatalln(err) + } } var (