提交 f8acc31b 编写于 作者: S Skylot

fix(gui): remove output directories from persistent settings (#447)

上级 bcadc282
......@@ -53,13 +53,18 @@ public class JadxArgsValidator {
} else {
outDir = makeDirFromInput(args);
}
args.setOutDir(outDir);
}
if (srcDir == null) {
args.setOutDirSrc(new File(args.getOutDir(), JadxArgs.DEFAULT_SRC_DIR));
}
if (resDir == null) {
args.setOutDirRes(new File(args.getOutDir(), JadxArgs.DEFAULT_RES_DIR));
}
args.setOutDir(outDir);
setFromOut(args);
checkDir(args.getOutDir());
checkDir(args.getOutDirSrc());
checkDir(args.getOutDirRes());
checkDir(args.getOutDir(), "Output");
checkDir(args.getOutDirSrc(), "Source output");
checkDir(args.getOutDirRes(), "Resources output");
}
@NotNull
......@@ -79,15 +84,6 @@ public class JadxArgsValidator {
return outDir;
}
private static void setFromOut(JadxArgs args) {
if (args.getOutDirSrc() == null) {
args.setOutDirSrc(new File(args.getOutDir(), JadxArgs.DEFAULT_SRC_DIR));
}
if (args.getOutDirRes() == null) {
args.setOutDirRes(new File(args.getOutDir(), JadxArgs.DEFAULT_RES_DIR));
}
}
private static void checkFile(File file) {
if (!file.exists()) {
throw new JadxArgsValidateException("File not found " + file.getAbsolutePath());
......@@ -97,9 +93,9 @@ public class JadxArgsValidator {
}
}
private static void checkDir(File dir) {
private static void checkDir(File dir, String desc) {
if (dir != null && dir.exists() && !dir.isDirectory()) {
throw new JadxArgsValidateException("Output directory exists as file " + dir);
throw new JadxArgsValidateException(desc + " directory exists as file " + dir);
}
}
......
......@@ -35,7 +35,7 @@ public class JadxWrapper {
this.decompiler.getArgs().setInputFiles(Collections.singletonList(file));
this.decompiler.load();
} catch (Exception e) {
LOG.error("Error load file: {}", file, e);
LOG.error("Jadx init error", e);
}
}
......
......@@ -26,12 +26,12 @@ public class JadxSettings extends JadxCLIArgs {
private static final String USER_HOME = System.getProperty("user.home");
private static final int RECENT_FILES_COUNT = 15;
private static final int CURRENT_SETTINGS_VERSION = 7;
private static final int CURRENT_SETTINGS_VERSION = 8;
private static final Font DEFAULT_FONT = new RSyntaxTextArea().getFont();
static final Set<String> SKIP_FIELDS = new HashSet<>(Arrays.asList(
"files", "input", "outputDir", "verbose", "printHelp"
"files", "input", "outDir", "outDirSrc", "outDirRes", "verbose", "printVersion", "printHelp"
));
private String lastOpenFilePath = USER_HOME;
private String lastSaveFilePath = USER_HOME;
......@@ -323,6 +323,12 @@ public class JadxSettings extends JadxCLIArgs {
if (getFont().getFontName().equals("Hack Regular")) {
setFont(null);
}
fromVersion++;
}
if (fromVersion == 7) {
outDir = null;
outDirSrc = null;
outDirRes = null;
}
settingsVersion = CURRENT_SETTINGS_VERSION;
sync();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册