MCPcopy Create free account
hub / github.com/PCGen/pcgen / getAllTemplates

Method getAllTemplates

code/src/java/pcgen/io/ExportUtilities.java:174–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 }
173
174 public static List<File> getAllTemplates()
175 {
176 try
177 {
178 File dir;
179 String outputSheetDirectory = SettingsHandler.getGameAsProperty().get().getOutputSheetDirectory();
180 if (outputSheetDirectory == null)
181 {
182 Logging.errorPrint("OUTPUTSHEET|DIRECTORY not defined for game mode " + SettingsHandler.getGameAsProperty().get());
183 dir = new File(ConfigurationSettings.getOutputSheetsDir());
184 }
185 else
186 {
187 dir = new File(ConfigurationSettings.getOutputSheetsDir(), outputSheetDirectory);
188 if (!dir.isDirectory())
189 {
190 Logging.errorPrint(
191 "Unable to find game mode outputsheets at " + dir.getCanonicalPath() + ". Trying base.");
192 dir = new File(ConfigurationSettings.getOutputSheetsDir());
193 }
194 }
195 if (!dir.isDirectory())
196 {
197 Logging.errorPrint("Unable to find outputsheets folder at " + dir.getCanonicalPath() + '.');
198 return Collections.emptyList();
199 }
200 return Files.walk(dir.toPath())
201 .filter(f -> !f.endsWith(".fo"))
202 .map(Path::toFile)
203 .collect(Collectors.toList());
204 }
205 catch (IOException e)
206 {
207 Logging.errorPrint("failed to find templates", e);
208 return Collections.emptyList();
209 }
210 }
211
212 public static FileChooser.ExtensionFilter getExtensionFilter(boolean pdf, String extension)
213 {

Callers 1

Calls 6

getGameAsPropertyMethod · 0.95
errorPrintMethod · 0.95
getOutputSheetsDirMethod · 0.95
emptyListMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected