github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/pkg/client/cli/intercept/prepare_mount_unix.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package intercept
     5  
     6  import (
     7  	"os"
     8  	"path/filepath"
     9  )
    10  
    11  func PrepareMount(cwd string, mountPoint string) (string, error) {
    12  	if mountPoint == "" {
    13  		return os.MkdirTemp("", "telfs-")
    14  	}
    15  
    16  	// filepath.Abs uses os.Getwd but we need the working dir of the cli
    17  	if !filepath.IsAbs(mountPoint) {
    18  		mountPoint = filepath.Join(cwd, mountPoint)
    19  		mountPoint = filepath.Clean(mountPoint)
    20  	}
    21  
    22  	return mountPoint, os.MkdirAll(mountPoint, 0o700)
    23  }