You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
AssetManager: fix resource loading if APK path contains spaces
Spaces will get encoded to %20 by the ClassLoader. We need to decode them again to get the original path.
This commit is contained in:
@@ -28,6 +28,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -114,6 +115,7 @@ public final class AssetManager {
|
|||||||
paths.add(null); // reserve first slot for framework-res.apk
|
paths.add(null); // reserve first slot for framework-res.apk
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
String path = resources.nextElement().getPath();
|
String path = resources.nextElement().getPath();
|
||||||
|
path = URLDecoder.decode(path, "UTF-8");
|
||||||
if (path.contains("framework-res.apk")) // needs to be first, so it can be overridden
|
if (path.contains("framework-res.apk")) // needs to be first, so it can be overridden
|
||||||
paths.set(0, path);
|
paths.set(0, path);
|
||||||
else if (!path.contains("com.google.android.gms")) // microg resources can not be merged
|
else if (!path.contains("com.google.android.gms")) // microg resources can not be merged
|
||||||
|
|||||||
Reference in New Issue
Block a user