Skip to content

Commit 51914bf

Browse files
author
veryben
committed
增加IniFileReader优先读取文件系统配置文件功能
1 parent ec1ed97 commit 51914bf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/org/csource/common/IniFileReader.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,16 @@ public String[] getValues(String name)
129129
private void loadFromFile(String confFilePath) throws IOException {
130130
InputStream in = null;
131131
try {
132+
// 优先从文件系统路径加载
133+
if (new File(confFilePath).exists()) {
134+
in = new FileInputStream(confFilePath);
135+
//System.out.println("loadFrom...file path done");
136+
}
132137
// 从类路径加载
133-
in = classLoader().getResourceAsStream(confFilePath);
134-
//System.out.println("loadFrom...class path done");
138+
else {
139+
in = classLoader().getResourceAsStream(confFilePath);
140+
//System.out.println("loadFrom...class path done");
141+
}
135142
readToParamTable(in);
136143
} catch (Exception ex) {
137144
ex.printStackTrace();

0 commit comments

Comments
 (0)