electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 2ca535225d633b548111509db5bd5191819d8fe1
parent 3716594331b575d6346b466d23bdcdbc573483a0
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 21 Dec 2019 06:53:10 +0100

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'

Diffstat:
Melectrum/util.py | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 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: