Issue
I am trying to create a directory outside of the project directory on MacOS Pro Big Sur V11.6 through a Flutter desktop app. I am using directory.createSync(recursive: true); of dart:io to do it. But that line of code caused an exception: FileSystemException (FileSystemException: Creation failed, path = '/Users/test/flutter_conductor_checkouts' (OS Error: Operation not permitted, errno = 1))
directory is LocalDirectory (LocalDirectory: '/Users/test/flutter_conductor_checkouts'. I changed the Security & Privacy of my Mac to allow Full Disk Access to VScode and Terminal, but the error still persists.
Is there a way to create a directory with a Flutter desktop app outside of the project directory on MacOS?
Solution
I found out what was the issue:
The app was sandboxed by default. It's shelling out the app which makes it impossible to create a directory outside of the app. I removed all com.apple.security.app-sandbox from the entitlements file in the macOS build folder.
And that worked for me.
Answered By - Isaak Newton
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.