def select_directory(paths):
 if (not paths):
  return core.getcwd()
 for path in paths:
  if core.isdir(path):
   return path
 return os.path.dirname(paths[0])

def select_directory ( paths ) : if ( not paths ) : return core . getcwd ( ) for path in paths : if core . isdir ( path ) : return path return os . path . dirname ( paths [ 0 ] )
return the first directory in a list of paths .