Platformsh\Cli\Helper\FilesystemHelper::makePathRelative PHP Method

makePathRelative() public method

Make a absolute path into a relative one.
public makePathRelative ( string $path1, string $path2 ) : string
$path1 string Absolute path.
$path2 string Target path.
return string The first path, made relative to the second path.
    public function makePathRelative($path1, $path2)
    {
        if (!is_dir($path2)) {
            $path2 = realpath(dirname($path2));
            if (!$path2) {
                return $path1;
            }
        }
        $result = rtrim($this->fs->makePathRelative($path1, $path2), DIRECTORY_SEPARATOR);
        return $result;
    }