1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/cmd/utils.go

35 lines
732 B
Go
Raw Normal View History

package cmd
import (
"os"
"path/filepath"
"github.com/SAP/jenkins-library/pkg/log"
)
// Deprecated: Please use piperutils.Files{} instead
func fileExists(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
return !info.IsDir()
}
func logWorkspaceContent() {
currentDir, err := os.Getwd()
if err != nil {
log.Entry().Errorf("Error getting current directory: %v", err)
}
log.Entry().Debugf("Contents of Workspace:")
filepath.Walk(currentDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
log.Entry().Errorf("Error parsing current directory: %v", err)
}
mode := info.Mode()
log.Entry().Debugf(" %s (%s)", path, mode)
return nil
})
}