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

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 UTC