mirror of
https://github.com/apple/pkl.git
synced 2026-04-24 17:28:37 +02:00
Encode filepaths to be safe on Windows
This changes the file paths to use characters that are safe for Windows. Channges the output of the following: * Package cache directory * Generated pkl-doc files * Kotlin generated code Unsafe characters are encoded as (<hex>). For example, the colon character `:` is encoded as `(3a)`. Additionally, this changes the cache directory prefix (package-1 to package-2). Follows the design of https://github.com/apple/pkl-evolution/pull/3
This commit is contained in:
@@ -51,7 +51,14 @@ class PackageServer : AutoCloseable {
|
||||
const val FRUIT_1_1_SHA = "8d982761d182f2185e4180c82190791d9a60c721cb3393bb2e946fab90131e8c"
|
||||
|
||||
fun populateCacheDir(cacheDir: Path) {
|
||||
val basePath = cacheDir.resolve("package-1/localhost:$PORT")
|
||||
doPopulateCacheDir(cacheDir.resolve("package-2/localhost(3a)$PORT"))
|
||||
}
|
||||
|
||||
fun populateLegacyCacheDir(cacheDir: Path) {
|
||||
doPopulateCacheDir(cacheDir.resolve("package-1/localhost:$PORT"))
|
||||
}
|
||||
|
||||
private fun doPopulateCacheDir(basePath: Path) {
|
||||
basePath.deleteRecursively()
|
||||
Files.walk(packagesDir).use { stream ->
|
||||
stream.forEach { source ->
|
||||
|
||||
Reference in New Issue
Block a user