1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Use the separator.

This commit is contained in:
Cedric Beust 2015-11-17 04:20:12 -08:00
parent 263c5d4e57
commit e5d0d9193a

View file

@ -14,12 +14,13 @@ open public class UnversionedDep(open val groupId: String, open val artifactId:
/** /**
* Turn this dependency to a directory. If fileSystem is true, use the file system * Turn this dependency to a directory. If fileSystem is true, use the file system
* dependent path separator, otherwise, use '/' (used to create URL's) * dependent path separator, otherwise, use '/' (used to create URL's). The returned
* string always ends with the path separator.
*/ */
public fun toDirectory(v: String, fileSystem: Boolean = true): String { public fun toDirectory(v: String, fileSystem: Boolean = true): String {
val sep = if (fileSystem) File.separator else "/" val sep = if (fileSystem) File.separator else "/"
val l = listOf(groupId.replace(".", sep), artifactId, v) val l = listOf(groupId.replace(".", sep), artifactId, v)
val result = Strings.Companion.join(sep, l) val result = Strings.Companion.join(sep, l)
return if (result.endsWith("/")) result else result + "/" return if (result.endsWith(sep)) result else result + sep
} }
} }