Skip to content

Commit

Permalink
fix(windows): create unique installer
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Jun 24, 2024
1 parent 197eaaa commit fa879a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions src/upgrade/cli_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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 {
Expand Down

0 comments on commit fa879a0

Please sign in to comment.