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
Vijayan T 06e81ea87d
Display workspace content for debugging (#4839)
* display workspace content for debugging

* adding verbose check

* renaming function
2024-02-22 12:21:13 +03:00

35 lines
732 B
Go

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
})
}