protected function getRelativeFile($base = '', $prepend = true)
{
// find file path w/o extension
$inputFile = $this->getInputFileWithoutExt();
$inputRoot = $this->getView()->getInputRootDir();
// Normalize direcotry separators so comparison works
$trans = array('/' => DIRECTORY_SEPARATOR, '\\' => DIRECTORY_SEPARATOR);
$inputFile = strtr($inputFile, $trans);
$inputRoot = strtr($inputRoot, $trans);
// Remove the input root from the input filename
$inputFile = str_replace($inputRoot, '', $inputFile);
// find relative path, wrt to output root dir
if ($base) {
$pos = strpos($inputFile, $base);
if ($pos !== false) {
$inputFile = substr($inputFile, $pos + ($prepend ? 0 : 1 + strlen($base)));
}
}
return $inputFile;
}