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

Method writeCustomItems

code/src/java/pcgen/core/CustomData.java:261–296  ·  view source on GitHub ↗

Write custom items out

()

Source from the content-addressed store, hash-verified

259 * Write custom items out
260 */
261 public static void writeCustomItems()
262 {
263
264 //check if custom equipment has been loaded. If not, just return without erasing customequipment.lst file
265 if (!customItemsLoaded && new File(customEquipmentFilePath()).exists())
266 {
267 if (Logging.isLoggable(Logging.WARNING))
268 {
269 Logging.log(
270 Logging.WARNING,
271 "Custom items had not been loaded, so we won't save them this time."); //$NON-NLS-1$
272 }
273 return;
274 }
275
276 ensureCustomDirExists();
277
278 try (BufferedWriter bw = getCustomEquipmentWriter())
279 {
280 bw.write(AUTO_GEN_WARN_LINE_1);
281 bw.newLine();
282 bw.write(AUTO_GEN_WARN_LINE_2);
283 bw.newLine();
284
285 for (Equipment aEq : Globals.getContext().getReferenceContext().getConstructedCDOMObjects(Equipment.class))
286 {
287 if (aEq.isType(Constants.TYPE_CUSTOM) && !aEq.isType("AUTO_GEN"))
288 {
289 aEq.save(bw);
290 }
291 }
292 } catch (IOException e)
293 {
294 Logging.errorPrint("Error in writeCustomItems", e);
295 }
296 }
297
298 /**
299 * Write custom purchase mode config

Callers 2

writeCustomFilesMethod · 0.95
shutdownMethod · 0.95

Calls 14

isLoggableMethod · 0.95
logMethod · 0.95
ensureCustomDirExistsMethod · 0.95
getContextMethod · 0.95
errorPrintMethod · 0.95
newLineMethod · 0.80
writeMethod · 0.65
getReferenceContextMethod · 0.65
isTypeMethod · 0.65

Tested by

no test coverage detected