Skip to content

Instantly share code, notes, and snippets.

@tonylukasavage
Created September 30, 2011 15:13
Show Gist options
  • Save tonylukasavage/1254047 to your computer and use it in GitHub Desktop.
Save tonylukasavage/1254047 to your computer and use it in GitHub Desktop.
var appFilePath = Ti.Filesystem.resourcesDirectory + 'w4.pdf';
var appFile = Ti.Filesystem.getFile(appFilePath);
var tmpFile = undefined,
newPath = undefined;
if (Ti.Filesystem.isExternalStoragePresent()) {
tmpFile = Ti.Filesystem.createTempFile();
newPath = tmpFile.nativePath + '.pdf';
tmpFile.move(newPath);
tmpFile = Ti.Filesystem.getFile(newPath);
tmpFile.write(appFile.read());
} else {
Ti.API.error('No external storage present');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment