aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/PhotoStorage/FileSystem.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/PhotoStorage/FileSystem.pm')
-rw-r--r--perllib/FixMyStreet/PhotoStorage/FileSystem.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/PhotoStorage/FileSystem.pm b/perllib/FixMyStreet/PhotoStorage/FileSystem.pm
index 0600f867d..d61a26c7a 100644
--- a/perllib/FixMyStreet/PhotoStorage/FileSystem.pm
+++ b/perllib/FixMyStreet/PhotoStorage/FileSystem.pm
@@ -16,6 +16,22 @@ has upload_dir => (
},
);
+=head2 init
+
+Creates UPLOAD_DIR and checks it's writeable.
+
+=cut
+
+sub init {
+ my $self = shift;
+ my $cache_dir = $self->upload_dir;
+ $cache_dir->mkpath;
+ unless ( -d $cache_dir && -w $cache_dir ) {
+ warn "\x1b[31mCan't find/write to photo cache directory '$cache_dir'\x1b[0m\n";
+ return;
+ }
+ return 1;
+}
=head2 get_file