Skip to content

Commit

Permalink
Revert "TransferService: small code optimization for on_transfer_comp…
Browse files Browse the repository at this point in the history
…leted"

This reverts commit 4c8d482.
  • Loading branch information
infirit committed Dec 20, 2024
1 parent 1a92d82 commit 14a7e06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions blueman/plugins/applet/TransferService.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ def _on_transfer_completed(self, _manager: Manager, transfer_path: str, success:
dest_dir, ignored = self._make_share_path()
filename = os.path.basename(src)

dest = os.path.join(dest_dir, filename)
if os.path.exists(dest):
if os.path.exists(os.path.join(dest_dir, filename)):
now = datetime.now()
filename = f"{now.strftime('%Y%m%d%H%M%S')}_{filename}"
logging.info(f"Destination file exists, renaming to: {filename}")

dest = os.path.join(dest_dir, filename)
shutil.move(src, dest)

try:
shutil.move(src, dest)
except (OSError, PermissionError):
Expand Down

0 comments on commit 14a7e06

Please sign in to comment.