vscode
vscode copied to clipboard
Stat all folders and files within appRoot as readonly (#138815)
Second attempt at resolving #138815 to reduce the likelihood of a naive user storing their projects within the appRoot folder and then being upset when a VS Code update deletes their files.
This PR implements @bpasero's suggestion at https://github.com/microsoft/vscode/pull/155443#issuecomment-1191411763 but also makes Explorer play nice.
/assign @bpasero
Submitting the PR has revealed that I've broken layering rules in the way I made Explorer work out whether to force metadata resolution so it gets to know when folders and files are read-only.
@bpasero please advise whether there's another way to achieve this.
To avoid the layer breaker I have made Explorer get metadata for all file:// uris.
Thanks, will review when I find time for it. @lramos15 fyi for explorer changes.
Added a warning notification when workspace opens, similar to the one the previous PR had per-file:
Sorry, will probably not have a lot of time this month, might push this back a bit.
@bpasero @lramos15 there have been two new issues raised this week by Windows users who have lost all their files. Neither yet proven to be caused by an update, but please can this PR make progress as a way of preventing future incidents of that sort?
@gjsjohnmurray I am not easy accepting this change, especially forcing requireMetadata
will have a severe significant impact on explorer performance and this case here only impacts a handful of users.
How about a different approach where we simply open a notification if a user opens the installation dir or any child of that as a workspace folder? We could even leverage the banner for this to make it more prominent:
![image](https://user-images.githubusercontent.com/900690/191663522-24f8a372-a16d-451b-8aea-b15d82b3bb2f.png)
Maybe it could also be a modal dialog to be very annoying.
@bpasero your verdict doesn't surprise me. I was uneasy about having to get metadata so unconditionally. Closing this. Please see #161534 instead.