Closed vfaronov closed 3 years ago
Path handling is indeed in a dire need for refactor. It's the oldest piece of code which I didn't admittedly expand properly. Right now this PR looks good but it might have some side effects. Am accepting it but might revert it in case of issues.
Fixes #500.
There was a confusion between paths relative to
self.path
(the top level of theFileList
) and to the parent (the expanded tree node). The former was passed to_delete_item_by_name
, but_find_iter_by_name
expected the latter. I changed it all to the latter, adding an extraparent_path
parameter where necessary, as was already the case with_update_emblems_by_name
, etc.This is all brittle, there are other path-related bugs around, so working with paths should probably be refactored somehow, but so far I cannot propose or implement such a refactoring.
Along the way, I noticed and removed two unused pieces of code.
if other_path is None
was never taken becauseother_path
was already being used above; and if it were somehow taken, it would mistakenly skip the updates at the end of_directory_changed
.