/**
  * Extracts the current ZIP package.
  *
  * @param  string $file Full path to the ZIP package
  * @return bool True on success
  */
 protected function _unzip($file)
 {
     include_once Plugin::classPath('Installer') . 'Lib/pclzip.lib.php';
     $File = new File($file);
     $to = normalizePath($File->folder()->pwd() . '/' . $File->name() . '_unzip/');
     if (is_readable($to)) {
         $folder = new Folder($to);
         $folder->delete();
     } else {
         $folder = new Folder($to, true);
     }
     $PclZip = new \PclZip($file);
     $PclZip->delete(PCLZIP_OPT_BY_EREG, '/__MACOSX/');
     $PclZip->delete(PCLZIP_OPT_BY_EREG, '/\\.DS_Store$/');
     if ($PclZip->extract(PCLZIP_OPT_PATH, $to)) {
         list($directories, $files) = $folder->read(false, false, true);
         if (count($directories) === 1 && empty($files)) {
             $container = new Folder($directories[0]);
             $container->move(['to' => $to]);
         }
         $this->_workingDir = $to;
         return true;
     }
     $this->err(__d('installer', 'Unzip error: {0}', [$PclZip->errorInfo(true)]));
     return false;
 }
 /**
  * _removeFile
  *
  * @param string $file Path of the file
  * @return bool
  */
 protected function _removeFile($file)
 {
     $_file = new File($file);
     if ($_file->exists()) {
         $_file->delete();
         $folder = $_file->folder();
         if (count($folder->find()) === 0) {
             $folder->delete();
         }
         return true;
     }
     return false;
 }