Ejemplo n.º 1
0
 public static function copyFile(Charcoal_File $src, Charcoal_File $dest)
 {
     // コピー元ファイルの確認
     if (!$src->isFile()) {
         _throw(new Charcoal_FileSystemException('copy', $src->getAbsolutePath() . ' is not file'));
     }
     if (!$src->isReadable()) {
         _throw(new Charcoal_FileSystemException('copy', $src->getAbsolutePath() . ' is not readable'));
     }
     // コピー先の確認
     $dir = $dest->getDir();
     if (!$dir->isDir()) {
         _throw(new Charcoal_FileSystemException('copy', $dir->getAbsolutePath() . ' is not directory'));
     }
     $src = us($src->getPath());
     $dest = us($dest->getPath());
     $result = copy($src, $dest);
     if (false === $result) {
         _throw(new Charcoal_FileSystemException('copy', "[src]{$src} [dest]{$dest}"));
     }
 }