Use global entry_name with the leading '/' removed to avoid double '/'s

Former-commit-id: 34e94942853ab637b15eef31701e5fa7e7b72160
Former-commit-id: f5db9245053daf860e533b96cc0ed02f31edee58
This commit is contained in:
2023-03-01 23:46:40 -05:00
parent 30962b8cb2
commit 0109816d3d
2 changed files with 37 additions and 43 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ from sys import exit as s_exit
def remote_list_gen(_client_device_name, _remote_dir): # prints all necessary remote data to stdout
# deletions
for _file in listdir(expanduser('~/.config/sshyp/deleted')):
for _file in listdir(expanduser('~/.config/sshyp/deleted')): # TODO copy expanduser change from sshyp
_file_path, _sep, _device = _file.partition('\x1f')
_file_path = _file_path.replace('\x1e', '/')
if _device == _client_device_name:
@@ -32,7 +32,7 @@ def remote_list_gen(_client_device_name, _remote_dir): # prints all necessary r
def delete(_file_path, _target_database): # deletes a file or folder and/or marks it for deletion upon syncing
from shutil import rmtree
try:
if _file_path.endswith('/'):
if _file_path.endswith('/'): # TODO properly check if _file_path is a directory
rmtree(f"{expanduser('~/.local/share/sshyp/')}{_file_path}")
else:
remove(f"{expanduser('~/.local/share/sshyp/')}{_file_path}.gpg")