 fs = Promise.promisifyAll require 'fs-extra'
 __ = i18n.setting.__.bind(i18n.setting)
 __n = i18n.setting.__n.bind(i18n.setting)
+windowManager = remote.require './lib/window'
 
 # we need only glob here
 globAsync = Promise.promisify require 'glob'

      plugin.packageName = path.basename pluginPath

    # Missing data of broken plugins

    if !plugin.displayName?
      if pluginData[plugin.packageName]?
        plugin.displayName =

          for child in displayItems
            if typeof child is "string"
              plugin.stringName = child

    # Handle new window
    if plugin.windowURL?
      if plugin.windowOptions?
        windowOptions = plugin.windowOptions
      else
        windowOptions =
          x: config.get 'poi.window.x', 0
          y: config.get 'poi.window.y', 0
          width: 800
          height: 600
      _.extend windowOptions,
        realClose: plugin.realClose
      if plugin.multiWindow
        plugin.handleClick = ->
          pluginWindow = windowManager.createWindow windowOptions
          pluginWindow.loadURL plugin.windowURL
      else
        if plugin.realClose
          pluginWindow = null
          plugin.handleClick = ->
            if !pluginWindow?
              pluginWindow = windowManager.createWindow windowOptions
              pluginWindow.on 'close', ->
                pluginWindow = null
              pluginWindow.loadURL plugin.windowURL
              pluginWindow.show()
            else
              pluginWindow.show()
        else
          pluginWindow = windowManager.createWindow windowOptions
          pluginWindow.loadURL plugin.windowURL
          plugin.handleClick = ->
            pluginWindow.show()

    plugin.isInstalled = true
    plugin.isOutdated = false
