wisski-cloud-distillery/internal/fsx/type.go
Tom Wiesing 35bb95c5ca
Show a warning when using wrong executable
This commit updates the 'wdcli' command to show a warning when using the
wrong executable.
2022-09-09 13:35:02 +02:00

24 lines
583 B
Go

// Package fsx provides convenient abstractions to work with the filesystem.
package fsx
import (
"os"
)
// Exists checks if the given path exists
func Exists(path string) bool {
_, err := os.Stat(path)
return err == nil
}
// IsDirectory checks if the provided path exists and is a directory
func IsDirectory(path string) bool {
info, err := os.Stat(path)
return err == nil && info.Mode().IsDir()
}
// IsFile checks if the provided path exists and is a regular file
func IsFile(path string) bool {
info, err := os.Stat(path)
return err == nil && info.Mode().IsRegular()
}