This repository has been archived on 2024-07-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Thresholds/src/main/java/dev/zontreck/otemod/database/FileTreeDatastore.java
Aria 5ee0aa47e9 Fix bugs that were preventing the mod from loading due to datapack issues
Restructure the vault system
Remove JDBC Drivers as a runtime requirement
Restructure profiles
Restructure homes
Restructure warps
Switch to a FileTreeDatastore
2023-02-24 01:27:35 -07:00

44 lines
1 KiB
Java

package dev.zontreck.otemod.database;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.fml.loading.FMLPaths;
public class FileTreeDatastore {
private static final Path BASE;
static{
Path X = FMLPaths.CONFIGDIR.get().resolve("otemod");
BASE=X;
if(!BASE.toFile().exists())
{
try {
Files.createDirectory(BASE);
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static Path of(String nick)
{
return BASE.resolve(nick);
}
public static List<File> getListOfFiles(Path files)
{
List<File> fileList = new ArrayList<>();
File[] entries = files.toFile().listFiles();
for (File file : entries) {
fileList.add(file);
}
return fileList;
}
}