I'm using Visual Studio Code with the C/C++ official extension from Microsoft to write C programs, running under macOS Catalina 10.15.3. The project folder lies in a path within the Documents folder on my home directory.
Every time I try to debug my code, a confirmation window pops up with the message "<program>" would like to access files in your Documents folder
. I have to click the OK button to proceed.
This slow downs my workflow, and is cluttering the list of allowed apps inside System Preferences => Security & Privacy => Privacy => Files and Folders (which, strangely, won't let me delete files from the list -- I'll ask a question about this in Ask Different later, but that's not the main issue: I want to get rid of this confirmation window altogether.)
Is there a way to go straight to a debug session without having to click OK on this message every time?
There's an issue in the C/C++ extension's GitHub issue tracker apparently about the same problem, and the suggested solution is to grant access to Terminal. However, this doesn't fix the issue for me -- in fact, access to the Documents folder was already granted to Terminal a long time ago since I use Terminal daily.
I've search high and low for a good solution to this that allows me to keep my project folders on my Desktop but haven't found anything. Apparently the Desktop, Documents, and Downloads files are just more strict now. I'm thinking macOS just thinks any change to a file that tries to access other files in these three folders is potentially nefarious and they try to play gatekeeper. It was obviously done as part of their security updates in moving towards tighter security but this is just such an unnecessary hiccup for developers.
Anyway, the only two solutions I've seen that work (I'm using Xcode, personally) is to move folders outside of the three folders I named earlier, or just run directly through the Terminal app rather than through an IDE. This obviously isn't perfect, but it works. I don't like not having my important projects on my Desktop anymore but until I find a better solution I guess that's what I'll do.