2002/css-validator/org/w3c/css/index IndexGenerator.java,1.2,1.3

Update of /sources/public/2002/css-validator/org/w3c/css/index
In directory hutz:/tmp/cvs-serv867/org/w3c/css/index

Modified Files:
	IndexGenerator.java 
Log Message:
Some changes to allow url to be adjusted if they are strange.
Changing the path to template and HTML files when it is not getting it well using getClass().getResources()...

Index: IndexGenerator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/index/IndexGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- IndexGenerator.java	20 Aug 2007 14:48:43 -0000	1.2
+++ IndexGenerator.java	23 Aug 2007 09:18:44 -0000	1.3
@@ -37,6 +37,7 @@
 	// inside)
 	public static VelocityContext vc = new VelocityContext();
 	private static String template_name = "validator.vm";
+	private static String html_files_path = "../../../../";
 
 	/**
 	 * @param args
@@ -78,15 +79,17 @@
 				path = new URI(path).getPath();
 			Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);
 			Velocity.init();
-			if (!new File(path + template_name).exists())
+			if (!new File(path + template_name).exists()) {
 				template_name = "org/w3c/css/css/" + template_name;
+				html_files_path = "";
+			}
 			Template tpl = Velocity.getTemplate(template_name, "UTF-8");
 			int count = 0;
 
 			// For each language, we set the context are create the template
 			for (int i = 0; i < Messages.languages_name.size(); ++i) {
 				name = String.valueOf(Messages.languages_name.get(i));
-				tmpFile = new File(path + "../../../../validator.html." + name);
+				tmpFile = new File(path + html_files_path + "validator.html." + name);
 
 				// Checking if the index files exists
 				// and if they have been created after the last template modification

Received on Thursday, 23 August 2007 09:18:53 UTC