Automatically remove old device names locally

This commit is contained in:
2022-02-16 12:37:20 -05:00
parent 2ba19f9a39
commit a0b5dad073
+3 -1
View File
@@ -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)