// Location gets the path to the context file
Location gets the path to the context file
// Location gets the path to the context file
func (c *File) Location() (path string, err error) {
	if rhoasContext := os.Getenv(ContextEnvName); rhoasContext != "" {
		_, err := os.Stat(rhoasContext)
		if os.IsNotExist(err) {
			return "", fmt.Errorf("Custom file path '%s' provided doesn't exist", rhoasContext)
		}
		path = rhoasContext
	} else {
		rhoasCtxDir, err := DefaultDir()
		if err != nil {
			return "", err
		}
		path = filepath.Join(rhoasCtxDir, "contexts.json")
		if err != nil {
			return "", err
		}
	}
	return path, nil
}
func ( c * File ) Location ( ) ( path string , err error ) { if rhoasContext := os . Getenv ( ContextEnvName ) ; rhoasContext != " " { _ , err := os . Stat ( rhoasContext ) if os . IsNotExist ( err ) { return " " , fmt . Errorf ( " " , rhoasContext ) } path = rhoasContext } else { rhoasCtxDir , err := DefaultDir ( ) if err != nil { return " " , err } path = filepath . Join ( rhoasCtxDir , " " ) if err != nil { return " " , err } } return path , nil }
Location gets the path to the context file
Location gets the path to the context file