From a0b5dad0739410f23cc9291e779f493989a5099d Mon Sep 17 00:00:00 2001 From: Cuan Date: Wed, 16 Feb 2022 12:37:20 -0500 Subject: [PATCH] Automatically remove old device names locally --- bin/sshyp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/sshyp b/bin/sshyp index 7455d3c..f02a825 100755 --- a/bin/sshyp +++ b/bin/sshyp @@ -107,6 +107,8 @@ def tweak(): # runs configuration wizard path.expanduser('~/.ssh/sshyp'), _ip, _port, _username_ssh) # device name configuration + for _name in listdir(path.expanduser('~/.config/sshyp/devices')): # remove existing device name + remove(f"{path.expanduser('~/.config/sshyp/devices/')}{_name}") print('\nIMPORTANT: This name MUST be unique amongst your client devices. ' '\nThis is used to keep track of which devices have up-to-date databases.\n') _client_device_name = str(input('What would you like to name this device? ')) @@ -243,7 +245,7 @@ def sync(): # calls sshync to sync changes to the user's server _folder_database = None s_exit() for _folder in _folder_database: - if Path(f"{path.expanduser('~/.password-pasture/')}{_folder[:-1]}").exists(): + if Path(f"{path.expanduser('~/.password-pasture/')}{_folder[:-1]}").is_dir(): pass else: Path(f"{path.expanduser('~/.password-pasture/')}{_folder[:-1]}").mkdir(0o700, parents=True, exist_ok=True)