wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.8k stars 818 forks source link

Remove Package on a symlinked package folder should just remove the symlink, not delete the files inside. #1460

Closed sparr closed 4 years ago

sparr commented 4 years ago

Today I lost about 12 hours of package development work because 'Remove Package' helpfully recursively deleted the contents of the package I was working on, which I had symlinked from my ~/src/ folder to my ~/.config/sublime-text-3/Packages/ folder so that I could start testing it.

After I've given up on doing data recovery I will probably try to tackle this issue on my own, but I'm recording it here now for posterity.

What should happen in this scenario is the symlink is deleted and nothing else.

Humorously, after deleting all the files, an error was raised that the directory could not be deleted, because it tried to use rmdir to remove the symlink.

wbond commented 4 years ago

For reference if someone wants to work on this, here is where removing a package happens: https://github.com/wbond/package_control/blob/0323d89aa61d228eeb59a7ca6278b0ae8c339a59/package_control/package_manager.py#L1959