Prevent Deletion When Source and Destination Are the Same#10
Conversation
… same Adds a check to prevent the deletion of a file when its source and destination paths are identical. This can occur when the music organizer is run on an already organized library. The fix introduces the following changes: - A new error, `ErrFileAlreadyExists`, is returned when the destination file already exists or when the source and destination paths are the same. - The `CopyMusic` function now checks if the destination file exists or if the source and destination paths are the same. - The `MoveMusic` function now checks for `ErrFileAlreadyExists` and skips the deletion of the source file if it is returned. - The `cmd/copy` command now handles `ErrFileAlreadyExists` as a non-fatal error. - A new test case has been added to verify that a file is not deleted when it is moved to the same location.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. |
This change prevents the music organizer from deleting files that are already correctly organized. When a file is moved to the same location, it will now be skipped instead of being deleted.
PR created automatically by Jules for task 524867552295453427