   #     missingRoute = appController.getOption('initialRoute') or route
   #     router.handleRoute missingRoute, { suppressListeners : yes, entryPoint }
 
+  checkAppAvailability : (name='')->
+    return KD.config.apps[name] and (name not in Object.keys KD.appClasses)
+
 
   open: do ->
 

  ###

  manifestsFetched = no

  @checkAppAvailability = (name='')->
    return (name.toLowerCase() in KD.config.allowedApps) and\
           (name not in Object.keys KD.appClasses)

  constructor:->


        @emit "AppCouldntBeCreated", appInstance
        @utils.defer => @quitByName appOptions.name, yes
        return no

    log 'AppManager: opening an app', name
    if @checkAppAvailability name
      log 'AppManager: couldn\'t find', name
      return KodingAppsController.putAppScript name, (err)=>
        log 'AppManager: loaded', name
        return warn err  if err
        KD.utils.defer => @create name, params, callback


    @utils.defer =>
      return @emit "AppCouldntBeCreated"  unless appInstance
