Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit 1ea7e63

Browse files
Merge pull request #14 from synonymdev/lnd-dir-change
Moves the Android LND files out of the root directory to "./lnd"
2 parents 9f517c0 + 7892ee8 commit 1ea7e63

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

android/src/main/java/com/reactnativelightning/ReactNativeLightningModule.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,14 @@ private void setAvailableMethods() {
109109

110110
@ReactMethod
111111
public void start(String configContent, String network, final Promise promise) {
112-
File appDir = getReactApplicationContext().getFilesDir();
113-
writeToConfig(configContent, appDir);
112+
String appDir = getReactApplicationContext().getFilesDir().toString().concat("/lnd");
113+
114+
File appFile = new File(appDir);
115+
if (!appFile.exists()){
116+
appFile.mkdirs();
117+
}
118+
119+
writeToConfig(configContent, new File(appDir));
114120

115121
final String logDir = appDir + "/logs/bitcoin/" + network;
116122
final String logFile = logDir + "/lnd.log";
@@ -331,7 +337,7 @@ public void run() {
331337

332338
@ReactMethod
333339
public void walletExists(String network, final Promise promise) {
334-
File directory = new File(getReactApplicationContext().getFilesDir().toString() + "/data/chain/bitcoin/" + network + "/wallet.db");
340+
File directory = new File(getReactApplicationContext().getFilesDir().toString() + "/lnd/data/chain/bitcoin/" + network + "/wallet.db");
335341
boolean exists = directory.exists();
336342
Log.d(TAG, "Wallet exists: " + exists);
337343
promise.resolve(exists);

0 commit comments

Comments
 (0)