fix: do not try to get existing AAPT binary if a path to it is provided

This commit is contained in:
oSumAtrIX 2023-08-11 00:50:32 +02:00
parent 355dae94b0
commit ad7520357f
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -365,7 +365,14 @@ public class AaptInvoker {
List<String> cmd = new ArrayList<>();
try {
String aaptCommand = AaptManager.getAaptExecutionCommand(aaptPath, getAaptBinaryFile());
// Instead of AaptManager.getAaptExecutionCommand(aaptPath, getAaptBinaryFile());
// it is needed to use the following command, because getAaptBinaryFile()
// may throw BrutException even when not used by AaptManager.getAaptExecutionCommand
File aaptFile;
if (aaptPath.isEmpty() || !(aaptFile = new File(aaptPath)).exists())
aaptFile = getAaptBinaryFile();
String aaptCommand = aaptFile.getPath();
cmd.add(aaptCommand);
} catch (BrutException ex) {
LOGGER.warning("aapt: " + ex.getMessage() + " (defaulting to $PATH binary)");