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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user