mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Revamp how classpath loading works
This commit is contained in:
@ -28,9 +28,12 @@
|
||||
|
||||
package org.jf.util;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PathUtil {
|
||||
private PathUtil() {
|
||||
@ -55,8 +58,8 @@ public class PathUtil {
|
||||
}
|
||||
|
||||
static String getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize) {
|
||||
ArrayList<String> basePath = getPathComponents(canonicalBaseFile);
|
||||
ArrayList<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
|
||||
List<String> basePath = getPathComponents(canonicalBaseFile);
|
||||
List<String> pathToRelativize = getPathComponents(canonicalFileToRelativize);
|
||||
|
||||
//if the roots aren't the same (i.e. different drives on a windows machine), we can't construct a relative
|
||||
//path from one to the other, so just return the canonical file
|
||||
@ -105,21 +108,21 @@ public class PathUtil {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static ArrayList<String> getPathComponents(File file) {
|
||||
public static List<String> getPathComponents(File file) {
|
||||
ArrayList<String> path = new ArrayList<String>();
|
||||
|
||||
while (file != null) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if (parentFile == null) {
|
||||
path.add(0, file.getPath());
|
||||
path.add(file.getPath());
|
||||
} else {
|
||||
path.add(0, file.getName());
|
||||
path.add(file.getName());
|
||||
}
|
||||
|
||||
file = parentFile;
|
||||
}
|
||||
|
||||
return path;
|
||||
return Lists.reverse(path);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user