mirror of https://github.com/sbt/sbt.git
Use last path component of a URI in the staged path.
This commit is contained in:
parent
1a3ea6fb8b
commit
6f0028e50d
|
|
@ -148,6 +148,19 @@ object Resolvers
|
|||
|
||||
def uniqueSubdirectoryFor(uri: URI, in: File) = {
|
||||
in.mkdirs()
|
||||
new File(in, Hash.halfHashString(uri.normalize.toASCIIString))
|
||||
val base = new File(in, Hash.halfHashString(uri.normalize.toASCIIString))
|
||||
val last = shortName(uri) match { case Some(n) => normalizeDirectoryName(n); case None => "root" }
|
||||
new File(base, last)
|
||||
}
|
||||
|
||||
private[this] def shortName(uri: URI): Option[String] =
|
||||
Option(uri.withoutMarkerScheme.getPath).flatMap {
|
||||
_.split("/").map(_.trim).filterNot(_.isEmpty).lastOption
|
||||
}
|
||||
|
||||
private[this] def normalizeDirectoryName(name: String): String =
|
||||
StringUtilities.normalize(dropExtensions(name))
|
||||
|
||||
private[this] def dropExtensions(name: String): String = name.takeWhile(_ != '.')
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue