diff --git a/xplat/src/main/java/lgbt/greenhouse/config/impl/GreenhouseConfigImpl.java b/xplat/src/main/java/lgbt/greenhouse/config/impl/GreenhouseConfigImpl.java index 1e427a3..57ab879 100644 --- a/xplat/src/main/java/lgbt/greenhouse/config/impl/GreenhouseConfigImpl.java +++ b/xplat/src/main/java/lgbt/greenhouse/config/impl/GreenhouseConfigImpl.java @@ -33,8 +33,6 @@ import net.minecraft.core.RegistryAccess; import org.jspecify.annotations.Nullable; import java.io.*; -import java.net.URISyntaxException; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.FileSystemException; @@ -556,13 +554,25 @@ public class GreenhouseConfigImpl { Path metaDataPath = GreenhouseConfigConstants.getPlatformHelper().getConfigDir() .resolve(".greenhouse_config_meta"); Path readMePath = metaDataPath - .resolve("README.md"); + .resolve("README.txt"); Path resolvedPath = metaDataPath .resolve(path.getFileName() + ".meta"); if (!Files.exists(metaDataPath) || !Files.isDirectory(metaDataPath)) { Files.deleteIfExists(metaDataPath); Files.createDirectories(metaDataPath); + + // README.txt + if (!Files.exists(readMePath)) { + try (InputStream readMeInput = GreenhouseConfigImpl.class.getResourceAsStream("/METADATA_README.txt")) { + if (readMeInput != null) { + Files.createFile(readMePath); + try (OutputStream fileOutput = Files.newOutputStream(readMePath)) { + fileOutput.write(readMeInput.readAllBytes()); + } + } + } + } } var dosFileAttributeView = Files.getFileAttributeView(metaDataPath, DosFileAttributeView.class); //noinspection ConstantValue @@ -570,18 +580,6 @@ public class GreenhouseConfigImpl { dosFileAttributeView.setHidden(true); } - // README.md - if (!Files.exists(readMePath)) { - try { - URL url = GreenhouseConfigImpl.class.getResource("METADATA_README.md"); - if (url != null) { - Files.copy(Path.of(url.toURI()), readMePath); - } - } catch (URISyntaxException e) { - CONFIG_SAVE_LOG.error("Failed to write metadata folder README", e); - } - } - // Metadata file Files.deleteIfExists(resolvedPath); // Delete the file in the case that it is corrupted Files.createFile(resolvedPath); diff --git a/xplat/src/main/resources/METADATA_README.txt b/xplat/src/main/resources/METADATA_README.txt new file mode 100644 index 0000000..e680fba --- /dev/null +++ b/xplat/src/main/resources/METADATA_README.txt @@ -0,0 +1,8 @@ +One of your mods includes a library named Greenhouse Config. +https://modrinth.com/project/greenhouse-config + +Greenhouse Config Meta is a folder for storing metadata relating to configs that the mod may need to perform specific actions. +For example this will store the current schema version of the config, which is then used to fix the config if it is out of date. + +As a player you will want to ignore this folder unless a developer tells you to modify something within it. +You are free to delete this folder at any time if you know none of your mods use Greenhouse Config. In this instance it is dead weight within your modpack instance.