config: keep wallets directory stable, regardless of wallet opens in other directories
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user