mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-05-24 01:44:38 -04:00
Fix artifactToPath for 1.19 JSON format
This commit is contained in:
@@ -331,7 +331,14 @@ public final class Tools {
|
||||
return strList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static String artifactToPath(String group, String artifact, String version) {
|
||||
public static String artifactToPath(String name) {
|
||||
int idx = name.indexOf(":");
|
||||
assert idx != -1;
|
||||
int idx2 = name.indexOf(":", idx+1);
|
||||
assert idx2 != -1;
|
||||
String group = name.substring(0, idx);
|
||||
String artifact = name.substring(idx+1, idx2);
|
||||
String version = name.substring(idx2+1).replace(':','-');
|
||||
return group.replaceAll("\\.", "/") + "/" + artifact + "/" + version + "/" + artifact + "-" + version + ".jar";
|
||||
}
|
||||
|
||||
@@ -575,8 +582,7 @@ public final class Tools {
|
||||
List<String> libDir = new ArrayList<String>();
|
||||
for (DependentLibrary libItem: info.libraries) {
|
||||
if(!checkRules(libItem.rules)) continue;
|
||||
String[] libInfos = libItem.name.split(":");
|
||||
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2]));
|
||||
libDir.add(Tools.DIR_HOME_LIBRARY + "/" + Tools.artifactToPath(libItem.name));
|
||||
}
|
||||
return libDir.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@@ -174,8 +174,7 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
|
||||
publishProgress("1", "Ignored " + libItem.name);
|
||||
//Thread.sleep(100);
|
||||
} else {
|
||||
String[] libInfo = libItem.name.split(":");
|
||||
String libArtifact = Tools.artifactToPath(libInfo[0], libInfo[1], libInfo[2]);
|
||||
String libArtifact = Tools.artifactToPath(libItem.name);
|
||||
outLib = new File(Tools.DIR_HOME_LIBRARY + "/" + libArtifact);
|
||||
outLib.getParentFile().mkdirs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user