Maybe fix problems with symlinks (#956)
This commit is contained in:
@@ -33,6 +33,7 @@ import me.lucko.luckperms.common.dependencies.relocation.Relocation;
|
||||
import me.lucko.luckperms.common.dependencies.relocation.RelocationHandler;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.storage.StorageType;
|
||||
import me.lucko.luckperms.common.utils.MoreFiles;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -82,7 +83,7 @@ public class DependencyManager {
|
||||
private Path getSaveDirectory() {
|
||||
Path saveDirectory = this.plugin.getBootstrap().getDataDirectory().resolve("lib");
|
||||
try {
|
||||
Files.createDirectories(saveDirectory);
|
||||
MoreFiles.createDirectoriesIfNotExists(saveDirectory);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Unable to create lib directory", e);
|
||||
}
|
||||
|
||||
+1
-2
@@ -57,7 +57,6 @@ import ninja.leaping.configurate.SimpleConfigurationNode;
|
||||
import ninja.leaping.configurate.Types;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -132,7 +131,7 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
||||
@Override
|
||||
public void init() throws IOException {
|
||||
this.dataDirectory = this.plugin.getBootstrap().getDataDirectory().resolve(this.dataDirectoryName);
|
||||
Files.createDirectories(this.dataDirectory);
|
||||
MoreFiles.createDirectoriesIfNotExists(this.dataDirectory);
|
||||
|
||||
this.uuidDataFile = MoreFiles.createFileIfNotExists(this.dataDirectory.resolve("uuidcache.txt"));
|
||||
this.uuidCache.load(this.uuidDataFile);
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class MoreFiles {
|
||||
}
|
||||
|
||||
public static Path createDirectoryIfNotExists(Path path) throws IOException {
|
||||
if (Files.exists(path) && Files.isDirectory(path)) {
|
||||
if (Files.exists(path) && (Files.isDirectory(path) || Files.isSymbolicLink(path))) {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -47,5 +47,14 @@ public final class MoreFiles {
|
||||
return path;
|
||||
}
|
||||
|
||||
public static Path createDirectoriesIfNotExists(Path path) throws IOException {
|
||||
if (Files.exists(path) && (Files.isDirectory(path) || Files.isSymbolicLink(path))) {
|
||||
return path;
|
||||
}
|
||||
|
||||
Files.createDirectories(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
private MoreFiles() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user