 path = require 'path'
 os = require 'os'
 fs = require 'fs'
+DecompressZip = require 'decompress-zip'
 
 packageFile = require './package.json'
 

      .pipe(fs.createWriteStream(targetPath))
      .on('close', doneCb)


  _update_win: (cb) ->

  _update_linux: (cb) ->

window.Updater = Updater

    filePath = execPath.substr(0, execPath.lastIndexOf("\\"))
    appPath = path.normalize(execPath ) #+ "/../../../../../../..")
    downloadTarget = os.tmpdir() + "/" + ".update.zip"
    extractFolder = os.tmpdir() + "/update/"
    self = this

    console.log "Requesting updates"
    this.is_update_available (err, update_available) ->
      if update_available
        self._download_update(downloadTarget,
         "#{updateServer}/#{packageFile.name}-osx-ia32.zip",
         (state) ->
           console.log state
        , () ->
          self._extract_update downloadTarget, extractFolder, (err) ->
            console.log err
            cb(err)
        )
      else
        console.log "No updates."

