Misc fixes

This commit is contained in:
Johannes Frohnmeyer 2022-02-06 17:15:00 +01:00
parent e445547337
commit 1431eb0719
Signed by: Johannes
GPG Key ID: E76429612C2929F4
4 changed files with 7 additions and 6 deletions

View File

@ -19,8 +19,8 @@ public class PathUtil {
fileName = fileName.endsWith(EXT_IMOD_DISABLED)
? fileName.substring(0, fileName.length() - EXT_IMOD_DISABLED.length())
: fileName.endsWith(EXT_IMOD_DISABLED2)
? fileName.substring(0, fileName.length() - EXT_IMOD_DISABLED2.length())
: fileName.substring(0, fileName.length() - EXT_IMOD.length());
? fileName.substring(0, fileName.length() - EXT_IMOD_DISABLED2.length())
: fileName.substring(0, fileName.length() - EXT_IMOD.length());
return p.getParent().resolve(fileName);
}
@ -39,7 +39,7 @@ public class PathUtil {
public static Path enable(Path p) {
String fileName = fn(p);
fileName = fileName.endsWith(EXT_IMOD_DISABLED2)
? fileName.substring(0, fileName.length() - EXT_IMOD_DISABLED2.length())
? fileName.substring(0, fileName.length() - EXT_IMOD_DISABLED2.length()) + EXT_IMOD
: fileName.substring(0, fileName.length() - EXT_DISABLED.length());
return p.getParent().resolve(fileName);
}

View File

@ -98,7 +98,8 @@ class ModsDirScannerImpl implements ModsDirScanner {
}
public boolean hasScanned(Path path) {
return scannedPaths.contains(path);
return scannedPaths.contains(path)
|| scannedPaths.contains(path.getParent().resolve(path.getFileName().toString() + ".imod"));
}
private void scanTaskInternal() {

View File

@ -12,7 +12,7 @@ public class NamedThreadFactory implements ThreadFactory {
public NamedThreadFactory(String name) {
this.group = Thread.currentThread().getThreadGroup();
this.namePrefix = name + "-pool-" + poolNumber.getAndIncrement() + "-thread-";
this.namePrefix = name + "-" + poolNumber.getAndIncrement() + "-";
}
public Thread newThread(Runnable r) {

View File

@ -152,7 +152,7 @@ public class HttpUtils {
}
}
// CurseForge serverside error
if (CURSEFORGE_API.matcher(url).matches() && res.statusCode() == 504) {
if (CURSEFORGE_API.matcher(url).matches() && res.statusCode() >= 500 && res.statusCode() < 600) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {