|
27 | 27 | import java.io.FileNotFoundException; |
28 | 28 | import java.io.IOException; |
29 | 29 | import java.io.PrintWriter; |
| 30 | +import java.nio.file.FileSystems; |
30 | 31 | import java.text.SimpleDateFormat; |
31 | 32 | import java.util.ArrayList; |
32 | 33 | import java.util.Date; |
@@ -91,8 +92,19 @@ public class StyleSheetGenerator extends StyleReport { |
91 | 92 | ClasspathResourceLoader.class.getName()); |
92 | 93 | Velocity.init(); |
93 | 94 |
|
| 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 | + } |
94 | 106 | FactoryConfiguration f; |
95 | | - f = ConfigurationUtils.findInClasspath("org/apache/velocity/tools/generic/tools.xml"); |
| 107 | + f = ConfigurationUtils.findInClasspath(sb_path.toString()); |
96 | 108 | velocityToolManager = new ToolManager(false, false); |
97 | 109 | velocityToolManager.configure(f); |
98 | 110 | } catch (Exception e) { |
@@ -202,7 +214,13 @@ public StyleSheetGenerator(ApplContext ac, String title, StyleSheet style, |
202 | 214 | produceStyleSheet(); |
203 | 215 |
|
204 | 216 | 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()); |
206 | 224 | template.setEncoding("utf-8"); |
207 | 225 | } catch (ResourceNotFoundException rnfe) { |
208 | 226 | System.err.println(rnfe.getMessage()); |
|
0 commit comments