Skip to content

Commit 6e80915

Browse files
committed
trying to address tools configuration and template location for windows
1 parent 92b6fb6 commit 6e80915

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

org/w3c/css/css/StyleSheetGenerator.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.FileNotFoundException;
2828
import java.io.IOException;
2929
import java.io.PrintWriter;
30+
import java.nio.file.FileSystems;
3031
import java.text.SimpleDateFormat;
3132
import java.util.ArrayList;
3233
import java.util.Date;
@@ -91,8 +92,19 @@ public class StyleSheetGenerator extends StyleReport {
9192
ClasspathResourceLoader.class.getName());
9293
Velocity.init();
9394

95+
String[] _path_comp = {"org", "apache", "velocity", "tools", "generic", "tools.xml"};
96+
StringBuilder sb_path = new StringBuilder();
97+
boolean is_first = true;
98+
for (String s : _path_comp) {
99+
if (!is_first) {
100+
sb_path.append(FileSystems.getDefault().getSeparator());
101+
} else {
102+
is_first = false;
103+
}
104+
sb_path.append(s);
105+
}
94106
FactoryConfiguration f;
95-
f = ConfigurationUtils.findInClasspath("org/apache/velocity/tools/generic/tools.xml");
107+
f = ConfigurationUtils.findInClasspath(sb_path.toString());
96108
velocityToolManager = new ToolManager(false, false);
97109
velocityToolManager.configure(f);
98110
} catch (Exception e) {
@@ -202,7 +214,13 @@ public StyleSheetGenerator(ApplContext ac, String title, StyleSheet style,
202214
produceStyleSheet();
203215

204216
try {
205-
template = Velocity.getTemplate("org/w3c/css/css/" + template_file);
217+
String[] _template_dir = {"org", "w3c", "css", "css"};
218+
StringBuilder sb_template_file = new StringBuilder();
219+
for (String s : _template_dir) {
220+
sb_template_file.append(s).append(FileSystems.getDefault().getSeparator());
221+
}
222+
sb_template_file.append(template_file);
223+
template = Velocity.getTemplate(sb_template_file.toString());
206224
template.setEncoding("utf-8");
207225
} catch (ResourceNotFoundException rnfe) {
208226
System.err.println(rnfe.getMessage());

0 commit comments

Comments
 (0)