How to find files and folders in MAC volume using App sandboxed application

心已入冬 提交于 2019-12-25 02:53:40

问题


I am creating a sand-boxed application on MAC(10.9).When App Sand-boxed is off then i am able to get files and folders from any path. But when I does App Sand-boxed enabled it's not accessing any files and folders from any path. Getting file and folder from path ("/Volumes/DriveName" or "/" etc.) when App Sand-boxed is off using Qt 5.0

// for folders

    QStringList folderlist;
       QDir curDir = QDir(path);   
       curDir.setFilter(QDir::Dirs);
       QFileInfoList list = curDir.entryInfoList();
       for(;<list.size;)
        {
             QfileInfo fileInfo = list.at(i);
             folderList << fileInfo.filePath();
        }
    // for files
    QStringList filelist;
        QDirIterator dirIn(path,filterfiles,QDir::AllEnteries);
        while(dirIn.hasnext())
    {
     dirIn.next();
    QfileInfo fileInfo = dirIn.fileInfo();
             filelist<< fileInfo.filePath();
    }

    What i do same when App sand-boxed is enabled?  

回答1:


That's the point of a sandbox, you can only access resources within the sandbox. A user may add files to the sandbox, but that requires your application to launch a file open dialog box, so they can choose the file they want to work with.

I suggest you start by reading the Apple documentation here.



来源:https://stackoverflow.com/questions/22929108/how-to-find-files-and-folders-in-mac-volume-using-app-sandboxed-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!