On Mojave, my app needs a way to determine if the user has already added the app to the "Full Disk Access" list in System Preferences. (And if not, instruct him to do so).
So far I've been using the following empirical test:
int c = open("/Library/Application Support/com.apple.TCC/TCC.db", O_RDONLY);
if (c == -1 && (errno == EPERM || errno == EACCES)) {
// no full disk access
}
However it turns out that on a small percentage of systems, this test gives NO even when the app is already in the "Full Disk Access" list.
I also noticed that on such systems, the folder /Library/Application Support/com.apple.TCC/ has access permissions 700 (drwx------), as opposed to "normal" systems where this folder has permissions 755 (drwxr-xr-x@). I guess this may be the reason why the test fails.
Anyway, is there any API or a more reliable test to see if my app has been added to the "Full Disk Access" list in System Preferences?