W3C home > Mailing lists > Public > www-validator-cvs@w3.org > June 2010

unicorn commit: fixed unicorn.home resolve

From: Mercurial notifier <nobody@w3.org>
Date: Mon, 21 Jun 2010 11:22:40 -0400
To: Unicorn Updates <www-validator-cvs@w3.org>
Message-Id: <E1OQipc-0002LL-47@blinky.w3.org>
changeset:   1282:e5d1ea30707f
user:        Thomas Gambet <tgambet@w3.org>
date:        Mon Jun 21 11:22:52 2010 -0400
files:       src/org/w3c/unicorn/Framework.java
description:
fixed unicorn.home resolve


diff -r 4516829792be -r e5d1ea30707f src/org/w3c/unicorn/Framework.java
--- a/src/org/w3c/unicorn/Framework.java	Mon Jun 21 10:45:25 2010 -0400
+++ b/src/org/w3c/unicorn/Framework.java	Mon Jun 21 11:22:52 2010 -0400
@@ -13,6 +13,7 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -132,13 +133,14 @@
 	public static void initCore() throws InitializationFailedException {
 		if (System.getProperty("unicorn.home") == null) {
 			try {
-				URL classesDir = Framework.class.getResource("/");
-				File classes = new File(classesDir.toURI());
-				File webInf = new File(classes.getParent());
-				System.setProperty("unicorn.home", webInf.getParent());
+				URL frameworkDir = Framework.class.getResource("Framework.class");
+				File unicornHome = new File(frameworkDir.toURI());
+				for (int i=0; i<6; i++)
+					unicornHome = unicornHome.getParentFile();
+				System.setProperty("unicorn.home", unicornHome.getAbsolutePath());
 			} catch (URISyntaxException e) {
 				throw new InitializationFailedException(e.getMessage(), e);
-			}
+			} 
 		}
 		
 		// Log4j initialization attempt
Received on Monday, 21 June 2010 15:25:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:21 GMT