示例#1
0
 /**
  * @return bool TRUE if the file has been successfully moved, FALSE otherwise
  * @throws EyeIOException
  */
 public function moveTo(IFile $file)
 {
     if (!$this->exists()) {
         throw new EyeFileNotFoundException($this->path . ' does not exist.');
     }
     if ($file->isDirectory()) {
         $target = $file->getChildFile($this->getName());
     } else {
         $target = $file;
     }
     if ($target->isFile()) {
         return false;
     }
     try {
         if ($target->copyFrom($this)) {
             $this->delete(true);
         }
     } catch (Exception $e) {
         throw new EyeIOException('Error occured during file move ' . $this->path . ' => ' . $file->getPath() . '.', 0, $e);
     }
     return true;
 }