pkg/environment: Remove some file-based functions
This commit removes certain file-based functions from 'pkg/environment', continuing the migration to entirely remove the package.
This commit is contained in:
parent
39207a1cb5
commit
45540ab253
20 changed files with 52 additions and 120 deletions
|
|
@ -3,30 +3,31 @@ package fsx
|
|||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
)
|
||||
|
||||
// Exists checks if the given path exists
|
||||
func Exists(env environment.Environment, path string) bool {
|
||||
_, err := env.Lstat(path)
|
||||
_, err := os.Lstat(path)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// IsDirectory checks if the provided path exists and is a directory
|
||||
func IsDirectory(env environment.Environment, path string) bool {
|
||||
info, err := env.Stat(path)
|
||||
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(env environment.Environment, path string) bool {
|
||||
info, err := env.Stat(path)
|
||||
info, err := os.Stat(path)
|
||||
return err == nil && info.Mode().IsRegular()
|
||||
}
|
||||
|
||||
// IsLink checks if the provided path exists and is a symlink
|
||||
func IsLink(env environment.Environment, path string) bool {
|
||||
info, err := env.Lstat(path)
|
||||
info, err := os.Lstat(path)
|
||||
return err == nil && info.Mode()&fs.ModeSymlink != 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue