aboutsummaryrefslogtreecommitdiff
path: root/src/Env.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Env.php')
-rw-r--r--src/Env.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Env.php b/src/Env.php
index 34b9f1f..38d9279 100644
--- a/src/Env.php
+++ b/src/Env.php
@@ -2,6 +2,7 @@
namespace Micropoly;
+use RuntimeException;
use SQLite3;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
@@ -77,4 +78,12 @@ class Env
return $db;
});
}
+
+ public function attachmentsPath(): string
+ {
+ $attachments = $this->config['attachments'];
+ if (!is_dir($attachments) || !is_writable($attachments))
+ throw new RuntimeException("Attachment directory '$attachments' is not a writable directory.");
+ return $attachments;
+ }
}