Created
March 17, 2016 06:35
-
-
Save falkolab/e0ec5e70db04e36a3ad9 to your computer and use it in GitHub Desktop.
How to access to file in storage card `/sdcard/anyfolder/myfile` in Titanium SDK
This file contains 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
// need storage permission to be added in manifest | |
function getFileFromExternalStorage(path) { | |
if(Ti.Filesystem.isExternalStoragePresent()) { | |
var file = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, path); | |
var newPath = file.nativePath.split(Ti.Filesystem.separator + Ti.App.id).join(''); | |
file = Ti.Filesystem.getFile(newPath); | |
if(file.exists()) return file; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment