Skip to content

Commit

Permalink
rename to exe in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bakito committed Sep 18, 2022
1 parent fb84b53 commit aeb422c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ func copyFile(dir string, file os.DirEntry, targetDir string, targetName string)
return err
}
defer from.Close()
to, err := os.OpenFile(filepath.Join(targetDir, targetName), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
toName := targetName
if runtime.GOOS == "windows" && !strings.HasSuffix(toName, ".exe") {
toName += ".exe"
}

to, err := os.OpenFile(filepath.Join(targetDir, toName), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil {
return err
}
Expand Down

0 comments on commit aeb422c

Please sign in to comment.