diff --git a/codex/codex.nim b/codex/codex.nim index 23f30766..282c5e0f 100644 --- a/codex/codex.nim +++ b/codex/codex.nim @@ -133,7 +133,15 @@ proc new*(T: type CodexServer, config: CodexConf): T = wallet = WalletRef.new(EthPrivateKey.random()) network = BlockExcNetwork.new(switch) - localStore = SQLiteStore.new(config.dataDir / "repo", cache = cache) + repoDir = config.dataDir / "repo" + + if io2.createPath(repoDir).isErr: + trace "Unable to create data directory for block store", dataDir = repoDir + raise (ref Defect)( + msg: "Unable to create data directory for block store: " & repoDir) + + let + localStore = SQLiteStore.new(repoDir, cache = cache) peerStore = PeerCtxStore.new() pendingBlocks = PendingBlocksManager.new() discovery = DiscoveryEngine.new(localStore, peerStore, network, blockDiscovery, pendingBlocks) diff --git a/tests/codex/stores/testsqlitestore.nim b/tests/codex/stores/testsqlitestore.nim index 449085cb..7d8975e1 100644 --- a/tests/codex/stores/testsqlitestore.nim +++ b/tests/codex/stores/testsqlitestore.nim @@ -38,6 +38,7 @@ proc runSuite(cache: bool) = setup: removeDir(repoDir) require(not dirExists(repoDir)) + createDir(repoDir) if cache: store = SQLiteStore.new(repoDir) diff --git a/vendor/nim-datastore b/vendor/nim-datastore index d5d986c0..2769ce1d 160000 --- a/vendor/nim-datastore +++ b/vendor/nim-datastore @@ -1 +1 @@ -Subproject commit d5d986c0140a46e957d9a88df40b7ce7dad424f3 +Subproject commit 2769ce1de21e595e712fd1df7a195c34cd5d18de