<?php
public function make_path2($curr_dir, $path) {
$this->error = "";
$result = "/";
if ($path[0] === "/") {
$path = substr($path, 1);
} else {
$path = substr($curr_dir, 1).'/'.$path;
}
if ($path) {
$splitpath=explode("/", $path);
foreach ($splitpath as $pathticle) {
switch($pathticle) {
case ".." :
$result = dirname($result);
// if second char of $result is not set, then current result is the rootNode
if (isset($result[1])) {
$result .= "/";
}
$result[0] = "/"; // make sure that even under windows, slashes are always forward slashes.
break;
case "." : break;
case "" : break;
default:
$result .= $pathticle."/";
break;
}
}
}
return $result;
}