Fix up the deodex warning

This commit is contained in:
Ben Gruver 2016-04-23 09:42:15 -07:00
parent 175480d4d0
commit f66362d073
2 changed files with 15 additions and 4 deletions

View File

@ -95,4 +95,8 @@ public class DeodexCommand extends DisassembleCommand {
@Override protected boolean needsClassPath() { @Override protected boolean needsClassPath() {
return true; return true;
} }
@Override protected boolean showDeodexWarning() {
return false;
}
} }

View File

@ -43,6 +43,8 @@ import org.jf.dexlib2.dexbacked.DexBackedDexFile;
import org.jf.dexlib2.dexbacked.DexBackedOdexFile; import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
import org.jf.dexlib2.iface.DexFile; import org.jf.dexlib2.iface.DexFile;
import org.jf.dexlib2.util.SyntheticAccessorResolver; import org.jf.dexlib2.util.SyntheticAccessorResolver;
import org.jf.util.ConsoleUtil;
import org.jf.util.StringWrapper;
import org.jf.util.jcommander.CommaColonParameterSplitter; import org.jf.util.jcommander.CommaColonParameterSplitter;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -181,10 +183,11 @@ public class DisassembleCommand extends DexInputCommand {
return; return;
} }
if (dexFile.hasOdexOpcodes()) { if (showDeodexWarning() && dexFile.hasOdexOpcodes()) {
System.err.println("Warning: You are disassembling an odex file without deodexing it. You"); System.err.println(StringWrapper.wrapStringOnBreaks(
System.err.println("won't be able to re-assemble the results unless you deodex it with the -x"); "Warning: You are disassembling an odex/oat file without deodexing it. " +
System.err.println("option"); "You won't be able to re-assemble the results unless you deodex it. See " +
"\"baksmali help deodex\"", ConsoleUtil.getConsoleWidth()));
} }
if (needsClassPath() && bootClassPath.isEmpty()) { if (needsClassPath() && bootClassPath.isEmpty()) {
@ -217,6 +220,10 @@ public class DisassembleCommand extends DexInputCommand {
return false; return false;
} }
protected boolean showDeodexWarning() {
return true;
}
protected BaksmaliOptions getOptions(DexFile dexFile) { protected BaksmaliOptions getOptions(DexFile dexFile) {
final BaksmaliOptions options = new BaksmaliOptions(); final BaksmaliOptions options = new BaksmaliOptions();