Fix: Package list file detection

This commit is contained in:
zt515 2018-01-01 23:53:10 +08:00
parent 29c4f92625
commit 0f182fb17f
2 changed files with 12 additions and 2 deletions

View File

@ -40,9 +40,12 @@ object SourceUtils {
builder.append(":${url.port}")
}
if (url.path != null && url.path.isNotEmpty()) {
val path = url.path
if (path != null && path.isNotEmpty()) {
builder.append("_")
builder.append(url.path.substring(1)) // Skip '/'
val fixedPath = path.replace("/", "_")
.substring(1) // skip the last '/'
builder.append(fixedPath)
}
builder.append("_dists_stable_main_binary-")
return builder.toString()

View File

@ -3,6 +3,8 @@ package io.neoterm
import io.neoterm.component.pm.PackageComponent
import io.neoterm.component.pm.SourceUtils
import io.neoterm.frontend.component.ComponentManager
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertTrue
import org.junit.Test
import java.io.File
@ -28,4 +30,9 @@ class PackageManagerTest {
System.err.println(pm.packages["rcs"]?.description)
}
@Test
fun testReplaceAll() {
assertEquals("/root/boom.sh".replace("/", "_"), "_root_boom.sh")
}
}