Add possibility to load templates from the filesystem
[Sone.git] / src / main / java / net / pterodactylus / sone / main / DebugLoaders.java
1 package net.pterodactylus.sone.main;
2
3 import java.io.File;
4
5 import net.pterodactylus.sone.template.FilesystemTemplate;
6 import net.pterodactylus.util.template.Template;
7
8 /**
9  * {@link Loaders} implementation that loads all resources from the filesystem.
10  *
11  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
12  */
13 public class DebugLoaders implements Loaders {
14
15         private final String filesystemPath;
16
17         public DebugLoaders(String filesystemPath) {
18                 this.filesystemPath = filesystemPath;
19         }
20
21         @Override
22         public Template loadTemplate(String path) {
23                 return new FilesystemTemplate(new File(filesystemPath, path).getAbsolutePath());
24         }
25
26 }