public function main() {
    $this->validate();

    // Remove existing destination first.
    if ($this->dest->exists()) {
      $this->log("Replacing existing resource '" . $this->dest->getPath() . "'");

      if ($this->dest->delete(TRUE) === FALSE) {
        throw new BuildException("Failed to delete existing destination '$this->dest'");
      }
    }

    // Link or copy the source artifact.
    $this->dest->getParentFile()->mkdirs();
    if ($this->mode == 'copy') {
      $this->log(sprintf("Copying '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      $this->source->copyTo($this->dest);
    }
    else {
      $this->log(sprintf("Linking '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      FileSystem::getFileSystem()->symlink($this->source->getPath(), $this->dest->getPath());
    }
  }
public function main() {
    $this->validate();

    // Remove existing destination first.
    if ($this->dest->exists()) {
      $this->log("Replacing existing resource '" . $this->dest->getPath() . "'");

      if ($this->dest->delete(TRUE) === FALSE) {
        throw new BuildException("Failed to delete existing destination '$this->dest'");
      }
    }

    // Link or copy the source artifact.
    $this->dest->getParentFile()->mkdirs();
    if ($this->mode == 'copy') {
      $this->log(sprintf("Copying '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      $this->source->copyTo($this->dest);
    }
    else {
      $this->log(sprintf("Linking '%s' to '%s'", $this->source->getPath(), $this->dest->getPath()));
      FileSystem::getFileSystem()->symlink($this->source->getPath(), $this->dest->getPath());
    }
  }
public function main ( ) { $ this -> validate ( ) ; // Remove existing destination first. if ( $ this -> dest -> exists ( ) ) { $ this -> log ( "Replacing existing resource '" . $ this -> dest -> getPath ( ) . "'" ) ; if ( $ this -> dest -> delete ( TRUE ) === FALSE ) { throw new BuildException ( "Failed to delete existing destination '$this->dest'" ) ; } } // Link or copy the source artifact. $ this -> dest -> getParentFile ( ) -> mkdirs ( ) ; if ( $ this -> mode == 'copy' ) { $ this -> log ( sprintf ( "Copying '%s' to '%s'" , $ this -> source -> getPath ( ) , $ this -> dest -> getPath ( ) ) ) ; $ this -> source -> copyTo ( $ this -> dest ) ; } else { $ this -> log ( sprintf ( "Linking '%s' to '%s'" , $ this -> source -> getPath ( ) , $ this -> dest -> getPath ( ) ) ) ; FileSystem :: getFileSystem ( ) -> symlink ( $ this -> source -> getPath ( ) , $ this -> dest -> getPath ( ) ) ; } }
Copy or link the resource.
Copy or link the resource .