Skip to content

Commit

Permalink
fix: break after determining file access level
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Feb 9, 2023
1 parent 1c28b7b commit 04bc433
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions permissions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ bool HasOpenSystemPreferencesDialog() {
for (NSString *file in files) {
const std::string can_read = CheckFileAccessLevel(file);
if (can_read == kAuthorized) {
break;
auth_status = kAuthorized;
break;
} else if (can_read == kDenied) {
auth_status = kDenied;
}
Expand All @@ -294,11 +294,7 @@ bool HasOpenSystemPreferencesDialog() {
std::string ScreenAuthStatus() {
std::string auth_status = kNotDetermined;
if (@available(macOS 10.16, *)) {
if (CGPreflightScreenCaptureAccess()) {
auth_status = kAuthorized;
} else {
auth_status = kDenied;
}
auth_status = CGPreflightScreenCaptureAccess() ? kAuthorized : kDenied;
} else if (@available(macOS 10.15, *)) {
auth_status = kDenied;
NSRunningApplication *runningApplication =
Expand Down

0 comments on commit 04bc433

Please sign in to comment.