mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Fix extra slash.
This commit is contained in:
parent
ca043beaf8
commit
ea8a812ed2
2 changed files with 10 additions and 13 deletions
|
@ -12,14 +12,14 @@ open class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.groupId
|
|||
val version: String get() = mavenId.version!!
|
||||
|
||||
private fun toFile(version: Version, suffix: String): String {
|
||||
val dir = toDirectory(version.version, false, trailingSlash = false)
|
||||
val list =
|
||||
if (version.snapshotTimestamp != null) {
|
||||
listOf(toDirectory(version.version, false),
|
||||
artifactId + "-" + version.noSnapshotVersion + "-" + version.snapshotTimestamp + suffix)
|
||||
} else {
|
||||
listOf(toDirectory(version.version, false), artifactId + "-" + version.version + suffix)
|
||||
}
|
||||
return list.joinToString("/")
|
||||
if (version.snapshotTimestamp != null) {
|
||||
listOf(dir, artifactId + "-" + version.noSnapshotVersion + "-" + version.snapshotTimestamp + suffix)
|
||||
} else {
|
||||
listOf(dir, artifactId + "-" + version.version + suffix)
|
||||
}
|
||||
return list.joinToString("/").replace("//", "/")
|
||||
}
|
||||
|
||||
fun toPomFile(v: String) = toFile(Version.of(v), ".pom")
|
||||
|
@ -28,8 +28,6 @@ open class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.groupId
|
|||
|
||||
fun toJarFile(v: String = version) = toFile(Version.of(v), suffix)
|
||||
|
||||
fun toJarFile(v: Version) = toFile(v, suffix)
|
||||
|
||||
fun toPomFileName() = "$artifactId-$version.pom"
|
||||
|
||||
fun toJarFile(r: RepoFinder.RepoResult) = toFile(r.snapshotVersion ?: r.version!!, suffix)
|
||||
|
|
|
@ -19,13 +19,12 @@ open class UnversionedDep(open val groupId: String, open val artifactId: String)
|
|||
|
||||
/**
|
||||
* Turn this dependency to a directory. If fileSystem is true, use the file system
|
||||
* dependent path separator, otherwise, use '/' (used to create URL's). The returned
|
||||
* string always ends with the path separator.
|
||||
* dependent path separator, otherwise, use '/' (used to create URL's).
|
||||
*/
|
||||
fun toDirectory(v: String, fileSystem: Boolean = true): String {
|
||||
fun toDirectory(v: String, fileSystem: Boolean = true, trailingSlash: Boolean = true): String {
|
||||
val sep = if (fileSystem) File.separator else "/"
|
||||
val l = listOf(groupId.replace(".", sep), artifactId, v)
|
||||
val result = Strings.Companion.join(sep, l)
|
||||
return if (result.endsWith(sep)) result else result + sep
|
||||
return if (trailingSlash && ! result.endsWith(sep)) result + sep else result
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue