Browse Source

config: keep wallets directory stable, regardless of wallet opens in other directories

master
Sander van Grieken 2 years ago
parent
commit
786979ec50
No known key found for this signature in database
GPG Key ID: 9BCF8209EA402EBA
  1. 2
      electrum/gui/qt/main_window.py
  2. 9
      electrum/simple_config.py

2
electrum/gui/qt/main_window.py

@ -669,7 +669,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.recently_visited_menu.setEnabled(bool(len(recent)))
def get_wallet_folder(self):
return os.path.dirname(os.path.abspath(self.wallet.storage.path))
return os.path.abspath(self.config.get_datadir_wallet_path())
def new_wallet(self):
try:

9
electrum/simple_config.py

@ -445,6 +445,7 @@ class SimpleConfig(Logger):
new_path = self.get_fallback_wallet_path()
# TODO: this can be removed by now
# default path in pre 1.9 versions
old_path = os.path.join(self.path, "electrum.dat")
if os.path.exists(old_path) and not os.path.exists(new_path):
@ -452,12 +453,14 @@ class SimpleConfig(Logger):
return new_path
def get_fallback_wallet_path(self):
def get_datadir_wallet_path(self):
util.assert_datadir_available(self.path)
dirpath = os.path.join(self.path, "wallets")
make_dir(dirpath, allow_symlink=False)
path = os.path.join(self.path, "wallets", "default_wallet")
return path
return dirpath
def get_fallback_wallet_path(self):
return os.path.join(self.get_datadir_wallet_path(), "default_wallet")
def remove_from_recently_open(self, filename):
recent = self.RECENTLY_OPEN_WALLET_FILES or []

Loading…
Cancel
Save