forked from java-decompiler/jd-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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); | ||
|
@@ -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"); | ||
|
||
|