github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/util/generic/executable_filename_windows.go (about)

     1  //go:build windows
     2  // +build windows
     3  
     4  package generic
     5  
     6  import (
     7  	"fmt"
     8  	"strings"
     9  )
    10  
    11  // ExecutableFilename appends '.exe' to a filename when necessary in order to
    12  // make it executable on Windows
    13  func ExecutableFilename(name string) string {
    14  	if strings.HasSuffix(name, ".exe") {
    15  		return name
    16  	}
    17  	return fmt.Sprintf("%s.exe", name)
    18  }