    @listen 'openFile', (entry, callback) ->
     console.log 'openFile', new Date
     return unless entry?
+    return if not entry.isFile
 
     chrome.storage.local.set
      file: chrome.fileSystem.retainEntry entry

     reader.readAsDataURL file

   loadDirEntry: (entry, callback) ->
    return unless entry.isDirectory
    console.log entry.fullPath
    reader = entry.createReader()
    self = this
    dirs = []

    readEntries = ->
     reader.readEntries onRead, self.on.error

    onRead = (results) ->
     if results.length is 0
      for e in dirs
       self.loadDirEntry e
      dirs = []
      return

     for e in results
      if e.isDirectory
       dirs.push e
      else
       self.addResource e
      readEntries()

    readEntries()


         setTimeout =>
          @loadSavedContent =>
           @_loading = false
          , 0
        , 0
       , 0

   loadRetainedDirectory: (callback) ->
    chrome.storage.local.get 'directory', (directory) =>
     directory = directory?.directory
     return callback() if not directory?
     chrome.fileSystem.isRestorable directory, (isRestorable) =>
      return callback() if not isRestorable
      chrome.fileSystem.restoreEntry directory, (d) =>
       @on.openDirectory d, callback

   loadRetainedFile: (callback) ->
    chrome.storage.local.get 'file', (file) =>
     file = file?.file
     return callback if not file?
     chrome.fileSystem.isRestorable file, (isRestorable) =>
      return callback() if not isRestorable
      chrome.fileSystem.restoreEntry file, (d) =>
       @on.openFile d, callback

   saveContent: (value, callback) ->
    return if @_loading
