Multiple files support
This commit is contained in:
parent
43a5e895ab
commit
61624dafae
|
|
@ -38,8 +38,8 @@ public class LSPatch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameter(description = "apk")
|
@Parameter(description = "apks")
|
||||||
private String apkPath = null;
|
private ArrayList<String> apkPaths = new ArrayList<>();
|
||||||
|
|
||||||
@Parameter(names = {"-h", "--help"}, help = true, order = 0, description = "Print this message")
|
@Parameter(names = {"-h", "--help"}, help = true, order = 0, description = "Print this message")
|
||||||
private boolean help = false;
|
private boolean help = false;
|
||||||
|
|
@ -105,13 +105,18 @@ public class LSPatch {
|
||||||
jCommander.usage();
|
jCommander.usage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (apkPath == null || apkPath.isEmpty()) {
|
if (apkPaths == null || apkPaths.isEmpty()) {
|
||||||
jCommander.usage();
|
jCommander.usage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
for (var apk : apkPaths) {
|
||||||
|
File srcApkFile = new File(apk).getAbsoluteFile();
|
||||||
|
System.out.println("Processing " + srcApkFile);
|
||||||
|
patch(srcApkFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File srcApkFile = new File(apkPath).getAbsoluteFile();
|
public void patch(File srcApkFile) throws PatchError, IOException {
|
||||||
|
|
||||||
if (!srcApkFile.exists())
|
if (!srcApkFile.exists())
|
||||||
throw new PatchError("The source apk file does not exit. Please provide a correct path.");
|
throw new PatchError("The source apk file does not exit. Please provide a correct path.");
|
||||||
|
|
||||||
|
|
@ -142,7 +147,7 @@ public class LSPatch {
|
||||||
ZFile zFile = ZFile.openReadWrite(tmpApk);
|
ZFile zFile = ZFile.openReadWrite(tmpApk);
|
||||||
|
|
||||||
// save the apk original signature info, to support crach signature.
|
// save the apk original signature info, to support crach signature.
|
||||||
String originalSignature = ApkSignatureHelper.getApkSignInfo(apkPath);
|
String originalSignature = ApkSignatureHelper.getApkSignInfo(srcApkFile.getAbsolutePath());
|
||||||
if (originalSignature == null || originalSignature.isEmpty()) {
|
if (originalSignature == null || originalSignature.isEmpty()) {
|
||||||
throw new PatchError("get original signature failed");
|
throw new PatchError("get original signature failed");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue