mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Server: change dir structure
This commit is contained in:
@@ -68,6 +68,6 @@ class FileRepository(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun String.toDataPath(): Path {
|
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")
|
val original = SyncData(10, "Hello world")
|
||||||
repo.put("abcdefg", original)
|
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))
|
assertTrue("$metaPath should exist", Files.exists(metaPath))
|
||||||
assertEquals("10", metaPath.toFile().readText())
|
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))
|
assertTrue("$dataPath should exist", Files.exists(dataPath))
|
||||||
assertEquals("Hello world", dataPath.toFile().readText())
|
assertEquals("Hello world", dataPath.toFile().readText())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user