From c18b0e77ab1f01a4f03f4de789331ed67f6ca1e7 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 7 Mar 2010 19:07:52 -0500 Subject: [PATCH] Use correct xsbt.version.properties in ComponentManager --- ivy/ComponentManager.scala | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ivy/ComponentManager.scala b/ivy/ComponentManager.scala index 0a67730d0..79b83fc32 100644 --- a/ivy/ComponentManager.scala +++ b/ivy/ComponentManager.scala @@ -80,9 +80,21 @@ object ComponentManager lazy val (version, timestamp) = { val properties = new java.util.Properties - val propertiesStream = getClass.getResourceAsStream("/xsbt.version.properties") + val propertiesStream = versionResource.openStream try { properties.load(propertiesStream) } finally { propertiesStream.close() } (properties.getProperty("version"), properties.getProperty("timestamp")) } lazy val stampedVersion = version + "_" + timestamp + + import java.net.URL + private def versionResource: URL = + { + import java.util.Collections.list + // could be just: + // getClass.getResource("/xsbt.version.properties") + // but the launcher up until 0.7.1 contained a stale xsbt.version.properties. + // post-0.7.1, only xsbti.jar contains xsbt.version.properties + // for the transition, we take the last one, which is the one we want because of the order resources are searched + list(getClass.getClassLoader.getResources("xsbt.version.properties")).toArray(new Array[URL](0)).last + } } \ No newline at end of file