Skip to content

Commit

Permalink
[Fix] Model not loaded on server side(Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai-Z-JP committed Jul 4, 2021
1 parent eb8d5a4 commit dc26865
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/jp/ngt/ngtlib/io/NGTFileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ public static List<File> getModsDir()//cpw.mods.fml.common.Loader
}

File modsDir = NGTCore.proxy.getMinecraftDirectory("mods");
String modsDirPath = normalizePath(modsDir.getAbsolutePath());
String modsDirPath = dev ? normalizePath(modsDir.getAbsolutePath()) : modsDir.getAbsolutePath();

MODS_DIR.add(new File(modsDirPath));
NGTLog.debug("[NGTFL] Add mods dir : " + modsDirPath);

File jarInJarModDir = NGTCore.proxy.getMinecraftDirectory("jar-mods-cache/v1");
MODS_DIR.add(new File(normalizePath(jarInJarModDir.getAbsolutePath())));
MODS_DIR.add(new File(dev ? normalizePath(jarInJarModDir.getAbsolutePath()) : jarInJarModDir.getAbsolutePath()));
NGTLog.debug("[NGTFL] Add jar-in-jar cache dir : " + modsDirPath);

return MODS_DIR;
Expand All @@ -167,7 +167,12 @@ public static List<File> getModsDir()//cpw.mods.fml.common.Loader
// cache pattern (String#replace compiles regex every time)
private static final Pattern dotSlashModRegex
= Pattern.compile(Pattern.quote(File.separator + "." + File.separator + "mods"));
private static final String slashMod = File.separator + "mods";
private static final String slashMod = getEscapedSeparator() + "mods";

private static String getEscapedSeparator() {
return File.separator.equals("\\") ? File.separator + File.separator : File.separator;
}

private static String normalizePath(String file) {
return dotSlashModRegex.matcher(file).replaceAll(slashMod);
}
Expand Down

0 comments on commit dc26865

Please sign in to comment.