Write custom items out
()
| 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 |
no test coverage detected