Fixed the moving of folders containing entries (entries are no longer deleted in sync mode)

Former-commit-id: 2773f7e35dc9f3bfbfb3959aff493e0f04e2a115
Former-commit-id: 9ad375002bb3942284cf93d120e3e0b21c5d34d4
This commit is contained in:
2023-05-09 14:45:07 -04:00
parent c42cfc548e
commit 50ffbf2ec8
2 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -33,7 +33,7 @@ def remote_list_gen(_client_device_name, _remote_dir):
# HYBRID # HYBRID
# deletes a file or folder and/or marks it for deletion upon syncing # deletes a file or folder and/or marks it for deletion upon syncing
def delete(_file_path, _target_database): def delete(_file_path, _target_database, _silent):
from shutil import rmtree from shutil import rmtree
_directory = f"{home}/.local/share/sshyp/" _directory = f"{home}/.local/share/sshyp/"
try: try:
@@ -42,6 +42,7 @@ def delete(_file_path, _target_database):
else: else:
remove(f"{_directory}{_file_path}.gpg") remove(f"{_directory}{_file_path}.gpg")
except FileNotFoundError: except FileNotFoundError:
if not _silent:
print(f"location does not exist {_target_database}") print(f"location does not exist {_target_database}")
if _target_database == 'remotely': if _target_database == 'remotely':
for _device_name in listdir(f"{home}/.config/sshyp/devices"): for _device_name in listdir(f"{home}/.config/sshyp/devices"):
@@ -88,7 +89,7 @@ def deletion_sync(_deletion_database, _silent):
if _file != '': if _file != '':
if not _silent: if not _silent:
print(f"\u001b[38;5;208m{_file}\u001b[0m has been sheared, removing...") print(f"\u001b[38;5;208m{_file}\u001b[0m has been sheared, removing...")
delete(_file, 'locally') delete(_file, 'locally', False)
# creates matches of remote folders on the local client # creates matches of remote folders on the local client
+5 -5
View File
@@ -654,13 +654,13 @@ def rename():
if not ssh_error: if not ssh_error:
Path(f"{directory}{_new_name}").mkdir(mode=0o700, parents=True, exist_ok=True) Path(f"{directory}{_new_name}").mkdir(mode=0o700, parents=True, exist_ok=True)
run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}", run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}",
f'python3 -c \'from pathlib import Path; Path("{directory_ssh}{_new_name}")' f'python3 -c \'from pathlib import Path; Path("{directory_ssh}{entry_name}")'
f'.mkdir(mode=0o700, parents=True, exist_ok=True)\'']) f'.rename(Path("{directory_ssh}{_new_name}"))\''])
else: else:
move(f"{directory}{entry_name}", f"{directory}{_new_name}") move(f"{directory}{entry_name}", f"{directory}{_new_name}")
if not ssh_error: if not ssh_error:
run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}", run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}",
f'cd /lib/sshyp; python3 -c \'from sshync import delete; delete("{entry_name}", "remotely")\'']) f'cd /lib/sshyp; python3 -c \'from sshync import delete; delete("{entry_name}", "remotely", True)\''])
# edits the contents of an entry # edits the contents of an entry
@@ -779,9 +779,9 @@ def remove_data():
determine_decrypt(f"{home}/.config/sshyp/lock.gpg", None, None) determine_decrypt(f"{home}/.config/sshyp/lock.gpg", None, None)
if not ssh_error: if not ssh_error:
run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}", run(['ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}",
f'cd /lib/sshyp; python3 -c \'from sshync import delete; delete("{entry_name}", "remotely")\'']) f'cd /lib/sshyp; python3 -c \'from sshync import delete; delete("{entry_name}", "remotely", False)\''])
else: else:
offline_delete(entry_name, 'locally') offline_delete(entry_name, 'locally', silent_sync)
# checks extension config files for matches to argument, runs extensions # checks extension config files for matches to argument, runs extensions