Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
Fixes ncorrect paths shown when run from root file system directory (#98
Browse files Browse the repository at this point in the history
)
  • Loading branch information
JakubOnderka committed May 27, 2017
1 parent ac6f757 commit 6e8d3ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ public function getFilePath()
*/
public function getShortFilePath()
{
return str_replace(getcwd(), '', $this->filePath);
$cwd = getcwd();

if ($cwd === '/') {
// For root directory in unix, do not modify path
return $this->filePath;
}

return preg_replace('/' . preg_quote($cwd, '/') . '/', '', $this->filePath, 1);
}

/**
Expand Down

0 comments on commit 6e8d3ea

Please # to comment.