check for non-existing local file after retrieve

this is almost always an error condition, but we need
  to translate the null for a better error message
This commit is contained in:
Mark Harrah 2010-09-21 22:26:04 -04:00
parent b16b0adc0f
commit 066e88e2e8
1 changed files with 5 additions and 17 deletions

View File

@ -23,24 +23,12 @@ object IvyRetrieve
}
def cachePath(reports: Seq[ArtifactDownloadReport]): Seq[File] =
reports map( _.getLocalFile )
for(r <- reports) yield
{
val file = r.getLocalFile
if(file eq null) error("No file for " + r.getArtifact) else file
}
def cachePaths(report: ResolveReport): Map[String, Seq[File]] =
reports(report).mapValues(confReport => cachePath(artifactReports(confReport)))
def copy(files: Set[File], cacheBase: File, to: File): Map[File, File] =
{
import Path._
val copyDef = files x rebase(cacheBase, to)
IO.copy( copyDef, overwrite = true, preserveLastModified = true )
copyDef.toMap
}
// TODO: not a sufficient way to do it: cacheBase is not necessarily common to all files
def retrieve(result: Map[String, Seq[File]], cacheBase: File, to: File): Map[String, Seq[File]] =
{
val all = result.values.flatten.toSet
val copyMap = copy(all, cacheBase, to)
result mapValues (_ map copyMap)
}
}