Skip to content

Instantly share code, notes, and snippets.

@minhnc
Created May 3, 2012 23:14
Show Gist options
  • Save minhnc/2590323 to your computer and use it in GitHub Desktop.
Save minhnc/2590323 to your computer and use it in GitHub Desktop.
Determine if File or Directory in iOS
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