github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/helpers/path.go (about)

     1  package helpers
     2  
     3  import (
     4  	"os"
     5  	"strings"
     6  )
     7  
     8  func PruneHome(pwd string) string {
     9  	if strings.HasPrefix(pwd, "~") {
    10  		userhome, err := os.UserHomeDir()
    11  		if err != nil {
    12  			panic(err)
    13  		}
    14  		pwd = userhome + pwd[1:]
    15  	}
    16  	return pwd
    17  }