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

unicorn commit: ~ do not guess unicorn.home if executed from jar

From: Mercurial notifier <nobody@w3.org>
Date: Fri, 17 Sep 2010 16:15:09 +0000
To: Unicorn Updates <www-validator-cvs@w3.org>
Message-Id: <E1Owdaf-0008Un-1U@blinky.w3.org>
changeset:   1496:84293ad22974
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Fri Sep 17 12:14:38 2010 -0400
files:       src/org/w3c/unicorn/Framework.java
description:
~ do not guess unicorn.home if executed from jar


diff -r 1bdd48dd5fb2 -r 84293ad22974 src/org/w3c/unicorn/Framework.java
--- a/src/org/w3c/unicorn/Framework.java	Fri Sep 17 11:38:45 2010 -0400
+++ b/src/org/w3c/unicorn/Framework.java	Fri Sep 17 12:14:38 2010 -0400
@@ -134,10 +134,12 @@
 		if (System.getProperty("unicorn.home") == null) {
 			try {
 				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());
+				if (frameworkDir.getProtocol() != "jar") {
+					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);
 			} 
Received on Friday, 17 September 2010 16:15:10 GMT

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