move readStrings from Env to MapUtil

This commit is contained in:
Mark Harrah 2010-05-02 19:02:23 -04:00
parent 4d312a01fa
commit db82974ea8
2 changed files with 8 additions and 7 deletions

View File

@ -251,13 +251,7 @@ trait BasicEnvironment extends Environment
propertyMap(name) = property
propertyMap //.readOnly (not currently in 2.8)
}
private val initialValues: Map[String, String] =
{
val map = new scala.collection.mutable.HashMap[String, String]
for(errorMsg <- impl.MapUtilities.read(map, envBackingPath, log))
log.error("Error loading properties from " + environmentLabel + " : " + errorMsg)
map //.readOnly (not currently in 2.8)
}
private val initialValues: Map[String, String] = impl.MapUtilities.readStrings(environmentLabel, envBackingPath, log)
def propertyNames: Iterable[String] = propertyMap.keys.toList
def getPropertyNamed(name: String): Option[UserProperty[_]] = propertyMap.get(name)

View File

@ -44,6 +44,13 @@ private[sbt] object MapUtilities
None
}
}
def readStrings(label: String, envBackingPath: Path, log: Logger): scala.collection.Map[String, String] =
{
val map = new HashMap[String, String]
for(errorMsg <- read(map, envBackingPath, log))
log.error("Error loading properties from " + label + " : " + errorMsg)
map.readOnly
}
def all[Key, Value](map: Map[Key, Set[Value]]): Iterable[Value] =
map.values.toList.flatMap(set => set.toList)