From 2ca535225d633b548111509db5bd5191819d8fe1 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sat, 21 Dec 2019 06:53:10 +0100 Subject: [PATCH] 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' --- electrum/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electrum/util.py b/electrum/util.py index f839d0fac..354bc1ac7 100644 --- a/electrum/util.py +++ b/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: