[minor] refactor and extend script dependencies resolving tests

This commit is contained in:
Ilya Chernikov
2019-09-17 17:13:12 +02:00
parent bda2e46697
commit 256d3a79e4
3 changed files with 123 additions and 77 deletions
@@ -115,10 +115,10 @@ internal fun ClassLoader.rawClassPathFromKeyResourcePath(keyResourcePath: String
(url.openConnection() as? JarURLConnection)?.jarFileURL?.toFileOrNull()
} else url.toFileOrNull()?.let { file ->
if (keyResourcePathDepth < 0) {
keyResourcePathDepth = keyResourcePath.trim('/').count { it == '/' }
keyResourcePathDepth = if (keyResourcePath.isBlank()) 0 else (keyResourcePath.trim('/').count { it == '/' } + 1)
}
var root = file
for (i in 0..keyResourcePathDepth) {
for (i in 0 until keyResourcePathDepth) {
root = root.parentFile
}
root