add stat for file existant checks
This commit is contained in:
parent
5dbd59fe8f
commit
367f0c978e
@ -2,6 +2,7 @@ package photosapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@ -24,7 +25,7 @@ func (s *Storage) Create(paths ...string) error {
|
||||
}
|
||||
|
||||
func (s *Storage) Exists(paths ...string) bool {
|
||||
f, err := os.Stat(s.Join(paths...))
|
||||
f, err := s.Stat(paths...)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
@ -38,3 +39,7 @@ func (s *Storage) Delete(paths ...string) error {
|
||||
return fmt.Errorf("%s doesn't exists", s.Join(paths...))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Storage) Stat(paths ...string) (fs.FileInfo, error) {
|
||||
return os.Stat(s.Join(paths...))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user