1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- require_once 'phing/Task.php';
- include_once 'phing/system/io/PhingFile.php';
- class MkdirTask extends Task {
-
- private $dir;
-
- function main() {
- if ($this->dir === null) {
- throw new BuildException("dir attribute is required", $this->location);
- }
- if ($this->dir->isFile()) {
- throw new BuildException("Unable to create directory as a file already exists with that name: " . $this->dir->getAbsolutePath());
- }
- if (!$this->dir->exists()) {
- $result = $this->dir->mkdirs();
- if (!$result) {
- $msg = "Directory " . $this->dir->getAbsolutePath() . " creation was not successful for an unknown reason";
- throw new BuildException($msg, $this->location);
- }
- $this->log("Created dir: " . $this->dir->getAbsolutePath());
- }
- }
-
- function setDir(PhingFile $dir) {
- $this->dir = $dir;
- }
- }
|