use of com.electronwill.nightconfig.core.file.FileConfig in project SpongeCommon by SpongePowered.
the class ModFileParsers method dummySpongeModParser.
public static IModFileInfo dummySpongeModParser(final IModFile realModFile, final String fileName, final IModFile iModFile) {
final ModFile modFile = (ModFile) iModFile;
AppLaunch.logger().debug("Considering sponge platform candidate {}", modFile.getFilePath());
final Path modsjson = modFile.getLocator().findPath(realModFile, fileName + ".toml");
if (!Files.exists(modsjson)) {
AppLaunch.logger().warn("Sponge platform file '{}' is missing the '{}' file", modFile, fileName + ".toml");
return null;
} else {
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
try {
return ModFileParsers.generateModFileMetadata(modFile, configWrapper);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
use of com.electronwill.nightconfig.core.file.FileConfig in project MinecraftForge by MinecraftForge.
the class ModFileParser method modsTomlParser.
public static IModFileInfo modsTomlParser(final IModFile imodFile) {
ModFile modFile = (ModFile) imodFile;
LOGGER.debug(LogMarkers.LOADING, "Considering mod file candidate {}", modFile.getFilePath());
final Path modsjson = modFile.findResource("META-INF", "mods.toml");
if (!Files.exists(modsjson)) {
LOGGER.warn(LogMarkers.LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
return null;
}
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
final ModFileInfo modFileInfo = new ModFileInfo(modFile, configWrapper);
configWrapper.setFile(modFileInfo);
return modFileInfo;
}
Aggregations