Example #1
0
 /**
  * Creates/mirrors the folder structure into the output_dir folder.
  *
  * @param object $collection
  * @return void
  */
 public function createStructure(Collection $collection)
 {
     $this->outputter->write('<info>Creating folder structure</info>');
     $directories = $collection->getDirectories();
     foreach ($directories as $dir) {
         $full = $this->config['output_dir'] . '/' . ltrim($dir->getRelativePath(), '/');
         $this->filesystem->mkdir($full);
         // Remove index.html/categories.html/tags.html from the directory, generate them later
         foreach (array('index.html', 'categories.html', 'tags.html') as $file) {
             $file = $full . '/' . $file;
             if ($this->filesystem->exists($file)) {
                 $this->outputter->write('<comment>Cleaning </comment> ' . $file);
                 $this->filesystem->unlink($file);
             }
         }
     }
     $this->outputter->write('<info>Finished folder structure</info>');
 }