Backend: Assume symlinks are directories #267
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
a1706a5922
commit
98abbfc94e
10
pkg/fs/fs.go
10
pkg/fs/fs.go
@ -25,11 +25,17 @@ func FileExists(filename string) bool {
|
||||
return err == nil && !info.IsDir()
|
||||
}
|
||||
|
||||
// PathExists returns true if path exists and is a directory.
|
||||
// PathExists returns true if path exists and is a directory or symlink.
|
||||
func PathExists(path string) bool {
|
||||
info, err := os.Stat(path)
|
||||
|
||||
return err == nil && info.IsDir()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
m := info.Mode()
|
||||
|
||||
return m&os.ModeDir != 0 || m&os.ModeSymlink != 0
|
||||
}
|
||||
|
||||
// Overwrite overwrites the file with data. Creates file if not present.
|
||||
|
Loading…
x
Reference in New Issue
Block a user