refactor(utils): 移除不再使用的方法.

当初开发 Maven 仓库搜索器时意外提交的, 已经可以移除了.
This commit is contained in:
LamGC 2022-05-07 01:43:15 +08:00
parent 8174f2a3a2
commit 95ad251826
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -7,7 +7,6 @@ import org.eclipse.aether.artifact.Artifact
import java.io.File import java.io.File
import java.io.FileFilter import java.io.FileFilter
import java.io.FilenameFilter import java.io.FilenameFilter
import java.net.URL
internal fun ByteArray.toHexString(): String = joinToString("") { it.toString(16) } internal fun ByteArray.toHexString(): String = joinToString("") { it.toString(16) }
@ -97,17 +96,3 @@ private object UtilsInternal {
log.debug { "All registered hook resources have been closed." } log.debug { "All registered hook resources have been closed." }
} }
} }
fun URL.resolveToFile(canonical: Boolean = true): File {
if ("file" != protocol) {
throw ClassCastException("Only the URL of the `file` protocol can be converted into a File object.")
}
val urlString = toString().substringAfter(':')
val file = File(urlString)
return if (canonical) {
file.canonicalFile
} else {
file
}
}