Fix (and no longer be symlink safe again )-;)
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'io.github.skippyall'
|
group = 'io.github.skippyall'
|
||||||
version = '1.0-SNAPSHOT'
|
version = '1.0.0'
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.github.skippyall.ruler;
|
package io.github.skippyall.ruler;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -12,10 +13,12 @@ public class FileUtils {
|
|||||||
|
|
||||||
public static String removeExtension(String path) {
|
public static String removeExtension(String path) {
|
||||||
if(path.contains(".")) {
|
if(path.contains(".")) {
|
||||||
return path.substring(0, path.lastIndexOf('.'));
|
int index = path.lastIndexOf('.');
|
||||||
} else {
|
if(index > path.lastIndexOf(FileSystems.getDefault().getSeparator())) {
|
||||||
return path;
|
return path.substring(0, index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getExtension(Path path) {
|
public static String getExtension(Path path) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ConfigLoader {
|
|||||||
}
|
}
|
||||||
RuleConfig config = null;
|
RuleConfig config = null;
|
||||||
Path configPath = FileUtils.append(fileWithoutExtension, ".config.json");
|
Path configPath = FileUtils.append(fileWithoutExtension, ".config.json");
|
||||||
String rulePath = RuleUtils.getRulePathFromWithoutExtension(fileWithoutExtension.toString());
|
String rulePath = RuleUtils.getRulePath(fileWithoutExtension);
|
||||||
if(Files.isRegularFile(configPath)) {
|
if(Files.isRegularFile(configPath)) {
|
||||||
try {
|
try {
|
||||||
config = RuleConfig.loadFromJson(JsonParser.parseReader(Files.newBufferedReader(configPath)), rulePath);
|
config = RuleConfig.loadFromJson(JsonParser.parseReader(Files.newBufferedReader(configPath)), rulePath);
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ public class RuleUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidRulePath(String path) {
|
public static boolean isValidRulePath(String path) {
|
||||||
return path.matches("([A-Za-z0-9\\-_.]+)") &&
|
return path.isEmpty() ||
|
||||||
|
path.matches("([A-Za-z0-9\\-_.]+)") &&
|
||||||
Arrays.stream(path.split("\\.")).noneMatch(String::isEmpty);
|
Arrays.stream(path.split("\\.")).noneMatch(String::isEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +47,7 @@ public class RuleUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInDirectory(Path path) {
|
public static boolean isInDirectory(Path path) {
|
||||||
try {
|
return path.toAbsolutePath().startsWith(getRoot());
|
||||||
return path.toRealPath().startsWith(getRoot());
|
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkDirectory(Path path) throws InvalidRulePathException {
|
public static void checkDirectory(Path path) throws InvalidRulePathException {
|
||||||
|
|||||||
+3
-2
@@ -4,7 +4,7 @@ plugins {
|
|||||||
id 'com.gradleup.shadow' version '9.4.1'
|
id 'com.gradleup.shadow' version '9.4.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.getParent().version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
base {
|
base {
|
||||||
@@ -76,6 +76,7 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
archiveClassifier = 'dev'
|
||||||
from("LICENSE") {
|
from("LICENSE") {
|
||||||
rename { "${it}_${project.archivesBaseName}"}
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ jar {
|
|||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
configurations = [project.configurations.shadowBundle]
|
configurations = [project.configurations.shadowBundle]
|
||||||
archiveClassifier = 'dev-shadow'
|
archiveClassifier = ''
|
||||||
relocate("de.themoep.minedown.adventure", "io.github.skippyall.minedown")
|
relocate("de.themoep.minedown.adventure", "io.github.skippyall.minedown")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loom_version=1.16-SNAPSHOT
|
loom_version=1.16-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
|
||||||
maven_group = io.github.skippyall
|
maven_group = io.github.skippyall
|
||||||
archives_base_name = ruler-fabric
|
archives_base_name = ruler-fabric
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user