Determine a directory is a package in swift -


how can tell if file package rather directory?

var isdir = objcbool(false) let exists = nsfilemanager.defaultmanager().fileexistsatpath(path, isdirectory: &isdir)  return isdir.boolvalue 

this code returns true both directories , packages.

there’s cocoa method, isfilepackageatpath, on nsworkspace that.

import cocoa  let sw = nsworkspace.sharedworkspace()  if sw.isfilepackageatpath("/applications/xcode.app") {     // true, execute. } if sw.isfilepackageatpath("/usr/bin") {     // false, won't execute. } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -