Created
May 3, 2012 23:14
-
-
Save minhnc/2590323 to your computer and use it in GitHub Desktop.
Determine if File or Directory in iOS
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
function isDir(path) { | |
var file = Ti.Filesystem.getFile(path); | |
if ( !file.exists() ) { | |
return false; | |
} | |
var nativePath = file.nativePath; | |
Ti.API.info(nativePath); | |
return nativePath.lastIndexOf('/') == nativePath.length - 1; | |
} | |
Ti.API.info( isDir( Ti.Filesystem.getResourcesDirectory() ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment