github.com/pluralsh/plural-cli@v0.9.5/pkg/utils/pathing/helpers.go (about)

     1  package pathing
     2  
     3  import (
     4  	"runtime"
     5  	"strings"
     6  )
     7  
     8  // returns a string (filepath) with appropriate slashes, dependent on OS. Optional parameters and method overloading unavailable in Go.
     9  func SanitizeFilepath(filepath string) string {
    10  	os := runtime.GOOS
    11  	switch os {
    12  	case "windows":
    13  		return strings.ReplaceAll(filepath, "\\", "/")
    14  	default:
    15  		return filepath
    16  	}
    17  }