Example #1
0
 /**
  * Returns either the directory (if the archive itself contains files at the first level) or the subdirectory if, like
  * many archiving programs, we the zip archive is a directory, THEN a list of files.
  *
  * @param string $dir The full path of the directory to be analyzed.
  *
  * @return string Returns the final directory containing the files to be used.
  */
 protected function getArchiveDirectory($dir)
 {
     $files = $this->f->getDirectoryContents($dir);
     // strip out items in directories that we know aren't valid
     if (count($files) == 1 && is_dir($dir . '/' . $files[0])) {
         return $dir . '/' . $files[0];
     } else {
         return $dir;
     }
 }