From b06b8753e6c88a6d1074ca59fbd2e8c85f234129 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 8 Feb 2019 12:59:06 +0100 Subject: [PATCH] fix #5088 --- electrum/daemon.py | 3 ++- electrum/storage.py | 6 +++--- electrum/util.py | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/electrum/daemon.py b/electrum/daemon.py index 89c81adca..7c05ef2b7 100644 --- a/electrum/daemon.py +++ b/electrum/daemon.py @@ -37,7 +37,7 @@ from .jsonrpc import VerifyingJSONRPCServer from .version import ELECTRUM_VERSION from .network import Network from .util import (json_decode, DaemonThread, print_error, to_string, - create_and_start_event_loop, profiler) + create_and_start_event_loop, profiler, standardize_path) from .wallet import Wallet, Abstract_Wallet from .storage import WalletStorage from .commands import known_commands, Commands @@ -235,6 +235,7 @@ class Daemon(DaemonThread): return response def load_wallet(self, path, password) -> Optional[Abstract_Wallet]: + path = standardize_path(path) # wizard will be launched if we return if path in self.wallets: wallet = self.wallets[path] diff --git a/electrum/storage.py b/electrum/storage.py index b32564e25..aa6e90cfe 100644 --- a/electrum/storage.py +++ b/electrum/storage.py @@ -35,7 +35,7 @@ import zlib from collections import defaultdict from . import util, bitcoin, ecc -from .util import PrintError, profiler, InvalidPassword, WalletFileException, bfh +from .util import PrintError, profiler, InvalidPassword, WalletFileException, bfh, standardize_path from .plugin import run_hook, plugin_loaders from .keystore import bip44_derivation @@ -73,7 +73,7 @@ class JsonDB(PrintError): def __init__(self, path): self.db_lock = threading.RLock() self.data = {} - self.path = os.path.normcase(os.path.abspath(path)) + self.path = standardize_path(path) self._file_exists = self.path and os.path.exists(self.path) self.modified = False @@ -156,7 +156,7 @@ class WalletStorage(JsonDB): def __init__(self, path, manual_upgrades=False): JsonDB.__init__(self, path) - self.print_error("wallet path", path) + self.print_error("wallet path", self.path) self.manual_upgrades = manual_upgrades self.pubkey = None if self.file_exists(): diff --git a/electrum/util.py b/electrum/util.py index f04f0c801..aa40c65a5 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -407,6 +407,10 @@ def assert_file_in_datadir_available(path, config_path): 'Should be at {}'.format(path)) +def standardize_path(path): + return os.path.normcase(os.path.realpath(os.path.abspath(path))) + + def get_new_wallet_name(wallet_folder: str) -> str: i = 1 while True: