mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-15 13:17:53 -08:00
fix(windows): create unique installer
This commit is contained in:
parent
197eaaa334
commit
fa879a0ec2
|
@ -10,7 +10,7 @@ require (
|
|||
github.com/alecthomas/repr v0.4.0 // indirect
|
||||
github.com/esimov/stackblur-go v1.1.0
|
||||
github.com/fogleman/gg v1.3.0
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/gookit/color v1.5.4
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
|
|
|
@ -8,6 +8,8 @@ import (
|
|||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
var successMsg = "Oh My Posh is installing in the background.\nRestart your shell in a minute to take full advantage of the new functionality."
|
||||
|
@ -20,14 +22,9 @@ func install() error {
|
|||
return errors.New("failed to get TEMP environment variable")
|
||||
}
|
||||
|
||||
path := filepath.Join(temp, "install.exe")
|
||||
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
err := os.Remove(path)
|
||||
if err != nil {
|
||||
return errors.New("unable to remove existing installer")
|
||||
}
|
||||
}
|
||||
id := uuid.New().String()
|
||||
fileName := fmt.Sprintf("oh-my-posh-install-%s.exe", id)
|
||||
path := filepath.Join(temp, fileName)
|
||||
|
||||
file, err := os.Create(path)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue