From 9e52e4e0bf82d50a31fe41fe1e11a84c81cde38f Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 29 Feb 2016 12:43:01 +0100 Subject: [PATCH] wallet-template: When constructing the wallet file name from the app's name, replace problematic characters so the filesystem doesn't throw up. --- wallettemplate/src/main/java/wallettemplate/Main.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wallettemplate/src/main/java/wallettemplate/Main.java b/wallettemplate/src/main/java/wallettemplate/Main.java index c730ceb5..a760f380 100644 --- a/wallettemplate/src/main/java/wallettemplate/Main.java +++ b/wallettemplate/src/main/java/wallettemplate/Main.java @@ -28,9 +28,11 @@ import java.net.URL; import static wallettemplate.utils.GuiUtils.*; public class Main extends Application { - public static String APP_NAME = "WalletTemplate"; - public static NetworkParameters params = MainNetParams.get(); + public static final String APP_NAME = "WalletTemplate"; + private static final String WALLET_FILE_NAME = APP_NAME.replaceAll("[^a-zA-Z0-9.-]", "_") + "-" + + params.getPaymentProtocolId(); + public static WalletAppKit bitcoin; public static Main instance; @@ -113,7 +115,7 @@ public class Main extends Application { public void setupWalletKit(@Nullable DeterministicSeed seed) { // If seed is non-null it means we are restoring from backup. - bitcoin = new WalletAppKit(params, new File("."), APP_NAME + "-" + params.getPaymentProtocolId()) { + bitcoin = new WalletAppKit(params, new File("."), WALLET_FILE_NAME) { @Override protected void onSetupCompleted() { // Don't make the user wait for confirmations for now, as the intention is they're sending it