Commits

Wez Furlong committed 6308564

render filenames relative to the cwd; makes output more compact

Comments (0)

Files changed (1)

     "\t/ indicates a line with less than 100% branch coverage\n\n";
 }
 
+function path_rel_to($path, $rel = null)
+{
+  if ($rel === null) {
+    $rel = getcwd();
+  }
+  if (substr($rel, -1) != '/') {
+    $rel .= '/';
+  }
+  if (!strncmp($path, $rel, strlen($rel))) {
+    $path = substr($path, strlen($rel));
+  }
+  return $path;
+}
+
 function crap_report(Console_CommandLine_Result $res)
 {
   $db = get_db();
         $crapload = 0;
       }
       printf(" %4d   %4d       %4d   %s:%s\n", $crap, $comp, $crapload,
-        $row['srcfile'], $row['funcname']);
+        path_rel_to($row['srcfile']), $row['funcname']);
     }
   }
 }