Actually fixed local folder deletion this time

This commit is contained in:
2022-02-16 01:13:35 -05:00
parent fc2f42a1aa
commit f65adc17f3
+2 -2
View File
@@ -221,7 +221,7 @@ def sync(): # calls sshync to sync changes to the user's server
_deletion_database = None _deletion_database = None
s_exit() s_exit()
for _file in _deletion_database: for _file in _deletion_database:
if _file.endswith('/'): if _file[:-1].endswith('/'):
try: try:
rmtree(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}") rmtree(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError: except FileNotFoundError:
@@ -229,7 +229,7 @@ def sync(): # calls sshync to sync changes to the user's server
else: else:
try: try:
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}") remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError: except (FileNotFoundError, IsADirectoryError):
print('File does not exist locally.\n') print('File does not exist locally.\n')
# set permissions before uploading # set permissions before uploading
system('find ' + directory + ' -type d -exec chmod -R 700 {} +') system('find ' + directory + ' -type d -exec chmod -R 700 {} +')