Maybe fix problems with symlinks (#956)
This commit is contained in:
@@ -32,6 +32,7 @@ import me.lucko.luckperms.common.dependencies.classloader.PluginClassLoader;
|
||||
import me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader;
|
||||
import me.lucko.luckperms.common.plugin.SchedulerAdapter;
|
||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||
import me.lucko.luckperms.common.utils.MoreFiles;
|
||||
import me.lucko.luckperms.sponge.utils.VersionData;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -53,7 +54,6 @@ import org.spongepowered.api.scheduler.SynchronousExecutor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@@ -242,7 +242,7 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
||||
public Path getDataDirectory() {
|
||||
Path dataDirectory = this.game.getGameDirectory().toAbsolutePath().resolve("luckperms");
|
||||
try {
|
||||
Files.createDirectories(dataDirectory);
|
||||
MoreFiles.createDirectoriesIfNotExists(dataDirectory);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
||||
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
||||
import me.lucko.luckperms.common.treeview.PermissionRegistry;
|
||||
import me.lucko.luckperms.common.utils.MoreFiles;
|
||||
import me.lucko.luckperms.sponge.calculators.SpongeCalculatorFactory;
|
||||
import me.lucko.luckperms.sponge.commands.SpongeMainCommand;
|
||||
import me.lucko.luckperms.sponge.contexts.SpongeContextManager;
|
||||
@@ -223,7 +224,7 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
Path path = this.bootstrap.getConfigPath().resolve("luckperms.conf");
|
||||
if (!Files.exists(path)) {
|
||||
try {
|
||||
Files.createDirectories(this.bootstrap.getConfigPath());
|
||||
MoreFiles.createDirectoriesIfNotExists(this.bootstrap.getConfigPath());
|
||||
try (InputStream is = getClass().getClassLoader().getResourceAsStream("luckperms.conf")) {
|
||||
Files.copy(is, path);
|
||||
}
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||
import me.lucko.luckperms.common.utils.MoreFiles;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -101,7 +102,7 @@ public class SubjectStorage {
|
||||
private Path resolveFile(String collectionIdentifier, String subjectIdentifier) {
|
||||
Path collection = this.container.resolve(collectionIdentifier);
|
||||
try {
|
||||
Files.createDirectories(collection);
|
||||
MoreFiles.createDirectoriesIfNotExists(collection);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -128,7 +129,7 @@ public class SubjectStorage {
|
||||
* @throws IOException if the write fails
|
||||
*/
|
||||
public void saveToFile(SubjectDataContainer container, Path file) throws IOException {
|
||||
Files.createDirectories(file.getParent());
|
||||
MoreFiles.createDirectoriesIfNotExists(file.getParent());
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
|
||||
this.gson.toJson(container.serialize(), writer);
|
||||
writer.flush();
|
||||
|
||||
Reference in New Issue
Block a user