Browse Source

fix #5088

sqlite_db
ThomasV 6 years ago
parent
commit
b06b8753e6
  1. 3
      electrum/daemon.py
  2. 6
      electrum/storage.py
  3. 4
      electrum/util.py

3
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]

6
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():

4
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:

Loading…
Cancel
Save