mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 19:16:09 +01:00
switch from URI to Paths
This commit is contained in:
parent
625d042c26
commit
a031787ece
@ -560,31 +560,28 @@ public class Androlib {
|
|||||||
|
|
||||||
// create filesystem
|
// create filesystem
|
||||||
Path path = Paths.get(outFile.getAbsolutePath());
|
Path path = Paths.get(outFile.getAbsolutePath());
|
||||||
URI apkFileSystem = new URI("jar", outFile.toURI().toString(), null);
|
|
||||||
|
|
||||||
// loop through files inside
|
// loop through files inside
|
||||||
for (Map.Entry<String,String> entry : files.entrySet()) {
|
for (Map.Entry<String,String> entry : files.entrySet()) {
|
||||||
|
|
||||||
file = new File(mPath.toFile(), entry.getKey());
|
file = new File(mPath.toFile(), entry.getKey());
|
||||||
if (file.isFile() && file.exists()) {
|
if (file.isFile() && file.exists()) {
|
||||||
insertFolder(apkFileSystem, zip_properties, file.getParentFile(), entry.getValue(), mPath.toAbsolutePath());
|
insertFolder(path, zip_properties, file.getParentFile(), entry.getValue(), mPath.toAbsolutePath());
|
||||||
insertFile(apkFileSystem, zip_properties, file, entry.getValue(), mPath.toAbsolutePath());
|
insertFile(path, zip_properties, file, entry.getValue(), mPath.toAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
} catch (URISyntaxException ex) {
|
|
||||||
throw new AndrolibException(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertFile(URI apkFileSystem, Map<String,String> zip_properties, File insert, String method, Path location)
|
private void insertFile(Path apkPath, Map<String,String> zip_properties, File insert, String method, Path location)
|
||||||
throws AndrolibException, IOException {
|
throws AndrolibException, IOException {
|
||||||
|
|
||||||
// ZipFileSystem only writes at .close()
|
// ZipFileSystem only writes at .close()
|
||||||
// http://mail.openjdk.java.net/pipermail/nio-dev/2012-July/001764.html
|
// http://mail.openjdk.java.net/pipermail/nio-dev/2012-July/001764.html
|
||||||
try(FileSystem fs = FileSystems.newFileSystem(apkFileSystem, zip_properties)) {
|
try(FileSystem fs = FileSystems.newFileSystem(apkPath, null)) {
|
||||||
|
|
||||||
Path root = fs.getPath("/");
|
Path root = fs.getPath("/");
|
||||||
|
|
||||||
@ -597,10 +594,10 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertFolder(URI apkFileSystem, Map<String,String> zip_properties, File insert, String method, Path location)
|
private void insertFolder(Path apkPath, Map<String,String> zip_properties, File insert, String method, Path location)
|
||||||
throws AndrolibException, IOException {
|
throws AndrolibException, IOException {
|
||||||
|
|
||||||
try(FileSystem fs = FileSystems.newFileSystem(apkFileSystem, zip_properties)) {
|
try(FileSystem fs = FileSystems.newFileSystem(apkPath, null)) {
|
||||||
|
|
||||||
Path root = fs.getPath("/");
|
Path root = fs.getPath("/");
|
||||||
Path dest = fs.getPath(root.toString(), insert.getAbsolutePath().replace(location.toString(),""));
|
Path dest = fs.getPath(root.toString(), insert.getAbsolutePath().replace(location.toString(),""));
|
||||||
|
Loading…
Reference in New Issue
Block a user