github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/runtime/envdef/constants.go (about)

     1  package envdef
     2  
     3  import (
     4  	"github.com/ActiveState/cli/internal/errs"
     5  	"github.com/ActiveState/cli/internal/fileutils"
     6  )
     7  
     8  // Constants is a map of constants that are being expanded in environment variables and file transformations to their installation-specific values
     9  type Constants map[string]string
    10  
    11  // NewConstants initializes a new map of constants that will need to be set to installation-specific values
    12  // Currently it only has one field `INSTALLDIR`
    13  func NewConstants(installdir string) (Constants, error) {
    14  	dir, err := fileutils.CaseSensitivePath(installdir)
    15  	if err != nil {
    16  		return nil, errs.Wrap(err, "Could not search for case sensitive install dir")
    17  	}
    18  
    19  	return map[string]string{
    20  		`INSTALLDIR`: dir,
    21  	}, nil
    22  }