File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ fun createDescriptorsFromBip32RootKey (
2828 val mnemonic = Mnemonic (WordCount .WORDS12 )
2929 val bip32ExtendedRootKey = DescriptorSecretKey (network, mnemonic, null )
3030 println (" Bip32 root key: $bip32ExtendedRootKey " )
31-
31+
3232 val descriptor: Descriptor = createScriptAppropriateDescriptor(
3333 activeWalletScriptType,
3434 bip32ExtendedRootKey,
@@ -64,13 +64,20 @@ fun createScriptAppropriateDescriptor(
6464 )
6565 }
6666}
67-
6867fun getPersistenceFilePath (): String {
69- val currentDirectory = Paths .get(" " ).toAbsolutePath().toString() + " /bdk-jvm/examples/src/main/kotlin/bdk_persistence.sqlite"
70- File (currentDirectory).apply {
68+ // Resolve absolute path to the fixed `examples/data` directory
69+ val projectRoot = Paths .get(" " ).toAbsolutePath().parent.resolve(" examples" )
70+ val persistenceDirectory = projectRoot.resolve(" data" ).toFile()
71+ val persistenceFilePath = projectRoot.resolve(" data/bdk_persistence.sqlite" ).toString()
72+
73+ persistenceDirectory.apply {
74+ if (! exists()) mkdirs()
75+ }
76+
77+ File (persistenceFilePath).apply {
7178 if (exists()) delete()
7279 }
73- return currentDirectory
80+ return persistenceFilePath
7481}
7582
7683enum class ActiveWalletScriptType {
You can’t perform that action at this time.
0 commit comments