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'
This commit is contained in:
SomberNight 2019-12-21 06:53:10 +01:00
parent 3716594331
commit 2ca535225d
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

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