github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/commandparser/construct_helpers.go (about)

     1  package commandparser
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  )
     7  
     8  func IsArtifactInDirectory(directory string, artifactFileName string) (bool, error) {
     9  
    10  	if _, directoryErr := os.Stat(directory); os.IsNotExist(directoryErr) {
    11  		return false, directoryErr
    12  	}
    13  
    14  	artifactPath := filepath.Join(directory, artifactFileName)
    15  
    16  	if _, err := os.Stat(artifactPath); os.IsNotExist(err) {
    17  		return false, nil
    18  	}
    19  	return true, nil
    20  }