Created
December 6, 2011 01:07
-
-
Save QGao/1436206 to your computer and use it in GitHub Desktop.
A sample shows how to set the "DO NOT BACKUP" flag in TiSDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir'); | |
Ti.API.info("Created mydir: " + newDir.createDirectory()); | |
Ti.API.info('newdir ' + newDir); | |
var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt'); | |
if(newFile.exists()){ | |
newFile.write("I should be backed up!"); | |
newFile.remoteBackup = true; | |
//or we can set the whole folder to be iCloudable | |
//newDir.remoteBackup = true; | |
} | |
var newFile2 = Titanium.Filesystem.getFile(newDir.nativePath,'dontbackup.txt'); | |
if(newFile2.exists()){ | |
newFile2.write("I should NOT be backed up!"); | |
newFile2.remoteBackup = false; | |
} | |
//------------------------------------- | |
//Test from your console | |
//------------------------------------- | |
// cd to your current directory | |
// xattr -p -x "com.apple.MobileBackup" * | |
// Output: backup.tex should return "00" and dontbackup.txt return "01" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir'); | |
Ti.API.info("Created mydir: " + newDir.createDirectory()); | |
Ti.API.info('newdir ' + newDir); | |
var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt'); | |
if(newFile.exists()){ | |
newFile.write("I should be backed up!"); | |
newFile.remoteBackup = true; | |
//or we can set the whole folder to be iCloudable | |
//newDir.remoteBackup = true; | |
} | |
var newFile2 = Titanium.Filesystem.getFile(newDir.nativePath,'dontbackup.txt'); | |
if(newFile2.exists()){ | |
newFile2.write("I should NOT be backed up!"); | |
newFile2.remoteBackup = false; | |
} | |
//------------------------------------- | |
//Test from your console | |
//------------------------------------- | |
// cd to your current directory | |
// xattr -p -x "com.apple.MobileBackup" * | |
// Output: backup.tex should return "00" and dontbackup.txt return "01" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment