Browse Source

util.standardize_path: properly handle "~" (user's home directory)

notably this is needed when the shell itself does not get a chance to expand "~",
e.g. when a path is passed via JSON-RPC

>>> os.path.normcase(os.path.realpath(os.path.abspath("~/.electrum/testnet/wallets/delete_me2")))
'/home/user/wspace/electrum/~/.electrum/testnet/wallets/delete_me2'
>>> os.path.normcase(os.path.realpath(os.path.abspath(os.path.expanduser("~/.electrum/testnet/wallets/delete_me2"))))
'/home/user/.electrum/testnet/wallets/delete_me2'
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
2ca535225d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/util.py

7
electrum/util.py

@ -458,7 +458,12 @@ def assert_file_in_datadir_available(path, config_path):
def standardize_path(path):
return os.path.normcase(os.path.realpath(os.path.abspath(path)))
return os.path.normcase(
os.path.realpath(
os.path.abspath(
os.path.expanduser(
path
))))
def get_new_wallet_name(wallet_folder: str) -> str:

Loading…
Cancel
Save