Hi all, i'm unable to get the path of the folder which exists in the external sdcard. I'm using the following code.....
var filename='xyz';//.......It is folder name var file= Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory,filename); alert("file path is"+file) //here i'm getting alert as..........[object file] if (file.exists()) { alert('file exists'); } else { alert("file not exists"); }I created the folder name in the external sdcard as 'xyz'. But always i'm getting 'false' value for the file.exists().
Any help would be appreciated.
2 Answers
hello,
Try this
var dir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory); Ti.API.info('external directoryListing = ' + dir.getParent().getDirectoryListing());You can also refer link
This did the trick for me, at least with SDK 3.1.0:
var dir = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory); Ti.API.info('external sdcard path = ' + dir.getParent().getNativePath());
Your Answer
Think you can help? Login to answer this question!