From 4a4b3c6aeb665445a008092821d063d0e5f9cd98 Mon Sep 17 00:00:00 2001 From: "Alinson S. Xavier" Date: Sat, 28 Nov 2020 22:27:55 -0600 Subject: [PATCH] Server: change dir structure --- .../src/org/isoron/uhabits/sync/repository/FileRepository.kt | 2 +- .../org/isoron/uhabits/sync/repository/FileRepositoryTest.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/org/isoron/uhabits/sync/repository/FileRepository.kt b/server/src/org/isoron/uhabits/sync/repository/FileRepository.kt index c9ea5b500..07c793049 100644 --- a/server/src/org/isoron/uhabits/sync/repository/FileRepository.kt +++ b/server/src/org/isoron/uhabits/sync/repository/FileRepository.kt @@ -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") } } \ No newline at end of file diff --git a/server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt b/server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt index c9d097778..047e0928e 100644 --- a/server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt +++ b/server/test/org/isoron/uhabits/sync/repository/FileRepositoryTest.kt @@ -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())