Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cddjr committed Mar 15, 2020
1 parent b3c1ced commit 8f3fc31
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.jd.gui.spi.TreeNodeFactory;
import org.jd.gui.util.exception.ExceptionUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
Expand All @@ -28,6 +30,16 @@ public AbstractTreeNodeFactoryProvider() {
Properties properties = new Properties();
Class clazz = this.getClass();

// Added by cddjr <[email protected]>
// https://github.com/java-decompiler/jd-gui/issues/291
Properties extProp = readExternalProperties(
new File(System.getProperty("user.dir") + File.separator
+ clazz.getSimpleName() + ".properties"));
if (extProp != null) {
init(extProp);
return;
}

try (InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".properties")) {
if (is != null) {
properties.load(is);
Expand All @@ -39,6 +51,17 @@ public AbstractTreeNodeFactoryProvider() {
init(properties);
}

protected Properties readExternalProperties(File file) {
try (InputStream is = new FileInputStream(file)) {
Properties properties = new Properties();
properties.load(is);
return properties;
} catch (IOException e) {
assert ExceptionUtil.printStackTrace(e);
}
return null;
}

protected void init(Properties properties) {
String selectors = properties.getProperty("selectors");

Expand Down

0 comments on commit 8f3fc31

Please sign in to comment.