mergXattr

mergXattr is an iOS external that adds commands to set the do not backup and protection attributes of a file.

mergXattr Syntax

command mergXattrAddSkipBackupAttributeToItemAtPath pFilePath

Syntax example:

mergXattrAddSkipBackupAttributeToItemAtPath specialFolderPath("library")&"/Private Documents/myfile.txt"

Sets the com.apple.MobileBackup or don not backup attribute.

Parameters:

  • pFilePath - the file path to set the attribute for

Sets the result to true if the command was successful or false otherwise.

command mergXattrSetProtectionAttributeToItemAtPath pFilePath,pAttributeOption

Syntax example:

mergXattrSetProtectionAttributeToItemAtPath specialFolderPath("library")&"/Private Documents/myfile.txt","complete"

Sets NSFileProtectionKey of a file

Parameters:

  • pFilePath - the file path to set the attribute for
  • pAttributeOption - one of:
    • “none” - No protection—The file is not encrypted on disk. You can use this option to remove data protection from an accessible file.
    • “complete” - The file is encrypted and inaccessible while the device is locked.
    • “complete unless open” - The file is encrypted. A closed file is inaccessible while the device is locked. After the user unlocks the device, your app can open the file and continue to use it even if the user locks the device again.
    • “complete until first user authentication” - The file is encrypted and inaccessible until after the device has booted and the user has unlocked it once.

Sets the result to true if the command was successful or false otherwise.

function mergXattrProtectedDataAvailable

Syntax example:

if mergXattrProtectedDataAvailable() then get url ("file://"& specialFolderPath("library")&"/Private Documents/myfile.txt")

Returns true if protected data files are avaialable to be read and false if otherwise.