diff options
| author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-08-17 18:29:33 -0400 |
|---|---|---|
| committer | simponic <simponic@hatecomputers.club> | 2024-08-17 18:29:33 -0400 |
| commit | b1775c4408bb00803eba321aa66ab92d6ba45580 (patch) | |
| tree | 90179edff8951b06abb91495ce21c8b1841d2d82 /adapters | |
| parent | 0b8883c236a06a14e5e6958ed47f89729b0e41aa (diff) | |
| download | hatecomputers.club-b1775c4408bb00803eba321aa66ab92d6ba45580.tar.gz hatecomputers.club-b1775c4408bb00803eba321aa66ab92d6ba45580.zip | |
kennel (#13)
Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/13
Co-authored-by: Elizabeth Hunt <elizabeth@simponic.xyz>
Co-committed-by: Elizabeth Hunt <elizabeth@simponic.xyz>
Diffstat (limited to 'adapters')
| -rw-r--r-- | adapters/files/files_adapter.go | 1 | ||||
| -rw-r--r-- | adapters/files/filesystem/filesystem.go | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/adapters/files/files_adapter.go b/adapters/files/files_adapter.go index bf3ea5f..44853e1 100644 --- a/adapters/files/files_adapter.go +++ b/adapters/files/files_adapter.go @@ -4,5 +4,6 @@ import "io" type FilesAdapter interface { CreateFile(path string, content io.Reader) (string, error) + FileExists(path string) bool DeleteFile(path string) error } diff --git a/adapters/files/filesystem/filesystem.go b/adapters/files/filesystem/filesystem.go index 726a588..e7e671f 100644 --- a/adapters/files/filesystem/filesystem.go +++ b/adapters/files/filesystem/filesystem.go @@ -35,3 +35,8 @@ func (f *FilesystemAdapter) CreateFile(path string, content io.Reader) (string, func (f *FilesystemAdapter) DeleteFile(path string) error { return os.Remove(f.BasePath + path) } + +func (f *FilesystemAdapter) FileExists(path string) bool { + _, err := os.Stat(f.BasePath + path) + return err == nil +} |
