Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. grant folder access permission alert many times at once on MacOS Monterey with M1 CPU

grant folder access permission alert many times at once on MacOS Monterey with M1 CPU

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 164 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hector_J
    wrote on last edited by Hector_J
    #1

    Qt version: 6.2.3
    This situation only happens on M1 CPU Monterey, Intel CPU work fine.
    When I used QDesktopServices::openUrl(QUrl(folderPath, QUrl::TolerantMode)); to open a removable volume folder, OS didn't remember the user already granted before and it will alert many times at once.
    So, I tried another solution to fix it, using "Finder" to open it with Applescript.

    auto f = [volumePath]() {
            system(QString::asprintf("osascript -e 'tell app \"Finder\" to open POSIX file \"%s\" activate'",volumePath.toLatin1().data()).toUtf8().data());
        };
       QThread *systemCallThread = QThread::create(f);
        systemCallThread->start();
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved