Server: change dir structure

pull/699/head
Alinson S. Xavier 5 years ago
parent 7979f74bea
commit 4a4b3c6aeb

@ -68,6 +68,6 @@ class FileRepository(
}
private fun String.toDataPath(): Path {
return basepath.resolve("${this.substring(0..1)}/${this.substring(2..3)}/$this")
return basepath.resolve("${this[0]}/${this[1]}/${this[2]}/${this[3]}/$this")
}
}

@ -39,11 +39,11 @@ class FileRepositoryTest {
val original = SyncData(10, "Hello world")
repo.put("abcdefg", original)
val metaPath = tempdir.resolve("ab/cd/abcdefg/version")
val metaPath = tempdir.resolve("a/b/c/d/abcdefg/version")
assertTrue("$metaPath should exist", Files.exists(metaPath))
assertEquals("10", metaPath.toFile().readText())
val dataPath = tempdir.resolve("ab/cd/abcdefg/content")
val dataPath = tempdir.resolve("a/b/c/d/abcdefg/content")
assertTrue("$dataPath should exist", Files.exists(dataPath))
assertEquals("Hello world", dataPath.toFile().readText())

Loading…
Cancel
Save