github.com/coveo/gotemplate@v2.7.7+incompatible/template/utils.go (about)

     1  package template
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"github.com/coveo/gotemplate/collections"
     7  	"github.com/coveo/gotemplate/errors"
     8  	"github.com/coveo/gotemplate/utils"
     9  )
    10  
    11  var must = errors.Must
    12  var trapError = errors.Trap
    13  var iif = collections.IIf
    14  var ifUndef = collections.IfUndef
    15  var defval = collections.Default
    16  
    17  type (
    18  	iList       = collections.IGenericList
    19  	iDictionary = collections.IDictionary
    20  )
    21  
    22  func getTargetFile(targetFile, sourcePath, targetPath string) string {
    23  	if targetPath != "" {
    24  		targetFile = filepath.Join(targetPath, utils.Relative(sourcePath, targetFile))
    25  	}
    26  	return targetFile
    27  }