With macOS 10.14 Mojave Apple added new (and more strict) security measures, which may cause some functions of the Troi File Plug-in to return an error. Some FileMaker script steps that worked before, will now return error code $$-5000, which is error afpAccessDenied (User does not have the correct access to the file). You can get this error on Mojave for example when you use the TrFile_CreateFile function.
Note the steps below are shown with macOS 10.14 (Mojave). But these steps can also fix it for later macOS version like macOS 10.15 (Catalina).
System Integrity Protection may cause the $$-5000 error
The reason for this error is that the System Integrity Protection feature, usually referred to as SIP, prevents access to more folders than before. System Integrity Protection is a security feature built into the macOS operating system that’s designed to protect system locations and processes from being written to, modified, or replaced.
For example, if you want your script to write in to a folder of Mail in the users Library, this script would work before Mojave and return without an error (error code zero):
Set Variable [$Filepath ; "filemac:/macHD/Users/user/Library/Mail/V6/MailData/test.txt" ] Set Variable [$ErrorCode ; TrFile_CreateFile( "-Unused "; $Filepath) ]
However when you try to run this script on Mojave you will get an error: $ErrorCode will be $$-5000.
The error will only occur if you try to change in a folder or file protected by SIP. This means that you can get the $$-5000 error with any step or function that modifies that folder or file. This will be the case with for example the functions TrFile_AppendContents, TrFile_CopyFile or TrFile_DeleteFile.
It can also occur with these script steps: Create File, Create Folder, Create Thumbnail, Create Zip, Delete File, Delete Folder or Insert in File.
NOTE the error can occur in other script steps or functions too.
Giving FileMaker Pro Full Disk access
To fix this problem you have to give FileMaker Pro Full Disk Access. You have to do this manually once on your computer:
- Go to System Preferences
- Open the Security & Privacy Preferences pane and select the Privacy tab
- Select Full Disk Access from the list of services
- Click the lock icon in the bottom left corner to unlock the interface
- Enter your macOS administrator password
- Click on the plus and add FileMaker Pro to the list of applications with Full Disk Access, by navigating to the FileMaker Pro app:
- If FileMaker Pro is running you get a warning to quit FileMaker Pro. Click on the Quit Now button.