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 (
28
28
val mnemonic = Mnemonic (WordCount .WORDS12 )
29
29
val bip32ExtendedRootKey = DescriptorSecretKey (network, mnemonic, null )
30
30
println (" Bip32 root key: $bip32ExtendedRootKey " )
31
-
31
+
32
32
val descriptor: Descriptor = createScriptAppropriateDescriptor(
33
33
activeWalletScriptType,
34
34
bip32ExtendedRootKey,
@@ -64,13 +64,20 @@ fun createScriptAppropriateDescriptor(
64
64
)
65
65
}
66
66
}
67
-
68
67
fun 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 {
71
78
if (exists()) delete()
72
79
}
73
- return currentDirectory
80
+ return persistenceFilePath
74
81
}
75
82
76
83
enum class ActiveWalletScriptType {
You can’t perform that action at this time.
0 commit comments