protected function moveFile($original, $destination)
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fileDir = dirname($destination);
     if (!$fs->exists($fileDir)) {
         $fs->mkdir($fileDir);
     }
     $fs->rename($original, $destination, true);
 }
 /**
  * Renames (moves) origin to target.
  *
  * @see \Symfony\Component\Filesystem\Filesystem::rename()
  *
  * @param string $origin
  * @param string $target
  * @param bool $overwrite
  */
 public static function rename($origin, $target, $overwrite = false)
 {
     self::possiblyFixGitPermissions($origin);
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->rename($origin, $target, $overwrite);
 }
Exemple #3
0
 /**
  * Extract style package to demo board.
  *
  * @return null
  */
 public function extract_package()
 {
     $this->package->ensure_extracted();
     $package_root = $this->package->find_directory(array('files' => array('required' => 'style.cfg')));
     $style_root = $this->get_style_dir();
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     $filesystem->remove($style_root);
     // Only copy necessary files
     $finder = new Finder();
     $finder->ignoreVCS(false)->ignoreDotFiles(false)->files()->notName('/\\.(svg|png|jpe?g|gif|html|js|css|cfg)$/i')->in($this->package->get_temp_path());
     $filesystem->remove($finder);
     $filesystem->rename($this->package->get_temp_path() . '/' . $package_root, $style_root);
 }
 /**
  * Extract style package to demo board.
  *
  * @return null
  */
 public function extract_package()
 {
     $this->package->ensure_extracted();
     $package_root = $this->package->find_directory(array('files' => array('required' => 'style.cfg')));
     $style_root = $this->get_style_dir();
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     $filesystem->remove($style_root);
     $filesystem->rename($this->package->get_temp_path() . '/' . $package_root, $style_root);
 }