MacOS Sandboxing WRITE files in App Container

374 Views Asked by At

I am trying to enable sandboxing on an application I am working. Although the application is heavily on a file system, for creating and saving and loading user files, It doesn't need the files to be located outside of the App container. But by enabling Sandboxing, I cannot write files in app anymore.

Is there anyway to achieve that?

void DeterminePaths(const string &a_arg0)
{
    string  s;
    FSRef   ref_num;
    char    str_path[1024];
    OSErr   e = noErr;

    e = FSFindFolder(kOnSystemDisk, kCurrentUserFolderType, false, &ref_num);
    e = FSRefMakePath(&ref_num, (UInt8*)str_path, 1024);
    s = string(str_path);

//Then I add on 's' the local directories for example s + "/silly_things"
}

<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.network.server</key>
    <true/>
</dict>
0

There are 0 best solutions below