diff --git a/modMcf/src/org/aion/mcf/account/Keystore.java b/modMcf/src/org/aion/mcf/account/Keystore.java index f4b137a2fb..3627e238fd 100644 --- a/modMcf/src/org/aion/mcf/account/Keystore.java +++ b/modMcf/src/org/aion/mcf/account/Keystore.java @@ -64,13 +64,22 @@ public class Keystore { private static final Logger LOG = AionLoggerFactory.getLogger(LogEnum.API.name()); - private static final String KEYSTORE_PATH = System.getProperty("user.dir") + "/keystore"; - private static final Path PATH = Paths.get(KEYSTORE_PATH); private static final FileDateTimeComparator COMPARE = new FileDateTimeComparator(); private static final Pattern HEX_64 = Pattern.compile("^[\\p{XDigit}]{64}$"); private static final String ADDR_PREFIX = "0x"; private static final String AION_PREFIX = "a0"; private static final int IMPORT_LIMIT = 100; + private static final String KEYSTORE_PATH; + private static final Path PATH; + + static { + String storageDir = System.getProperty("local.storage.dir"); + if (storageDir == null || storageDir.equalsIgnoreCase("")) { + storageDir = System.getProperty("user.dir"); + } + KEYSTORE_PATH = storageDir + "/keystore"; + PATH = Paths.get(KEYSTORE_PATH); + } private static List getFiles() { File[] files = PATH.toFile().listFiles();