github.com/pavlo67/common@v0.5.3/common/filelib/path.go (about)

     1  package filelib
     2  
     3  import (
     4  	"path/filepath"
     5  	"strings"
     6  )
     7  
     8  func Join(basePath, path string) string {
     9  	if path = strings.TrimSpace(path); path == "" {
    10  		return basePath
    11  	} else if filepath.VolumeName(path) != "" {
    12  		return path
    13  	} else if filepath.ToSlash(path)[0] == '/' {
    14  		return path
    15  	}
    16  
    17  	return filepath.Join(basePath, path)
    18  
    19  }