Example #1
0
File: pantr.php Project: pago/pantr
 public static function symlink($origin_dir, $target_dir, $copy_on_windows = false)
 {
     if (!function_exists('symlink') && $copy_on_windows) {
         $finder = pantrFinder::type('any')->ignore_version_control();
         pantr::mirror($finder, $origin_dir, $target_dir);
         return;
     }
     $ok = false;
     if (is_link($target_dir)) {
         if (readlink($target_dir) != $origin_dir) {
             unlink($target_dir);
         } else {
             $ok = true;
         }
     }
     if (!$ok) {
         pantr::writeAction('link+', $target_dir);
         symlink($origin_dir, $target_dir);
     }
 }