Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#2535 created a setting to allow the user to choose a folder to use as a download cache. For convenience, it also attempted to copy cached files from the old folder to the new when the setting changed.
This just wasn't safe. First @politas had a mishap where it tried to copy the same folder to the same folder and deleted all the cached files. Then I partly scrambled my home directory just by holding backspace to clear the field in GUI. If the two developers working on some code aren't able to use it correctly, it's too error-prone and needs to be fixed.
Changes
MoveFrom
now will only delete a duplicate file if the creation timestamps are different. If the same timestamp is found, then we conclude that the parent folder is the same as the destination folder, and stop copying the folder completely. This ensures that we never consider the same file a duplicate of itself and delete it.MoveFrom
also is no longer called when you change the cache folder setting. Migrating cached files is now the user's responsibility. This will prevent us from moving files to or from incorrect paths while the user is editing the field in GUI.Maybe we'll be able to find a good way to auto-move cached files, but this pull request is just about limiting the damage.
Fixes #2537.