You are here

function hosting_path_normalize in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 hosting.inc \hosting_path_normalize()
  2. 7.3 hosting.inc \hosting_path_normalize()

Make a path canonical.

This removes duplicate slashes, trailing slashes and /./ occurences. It does not (yet?) resolve .. instances.

File

./hosting.inc, line 92
General purpose Hosting module functions.

Code

function hosting_path_normalize($path) {
  return rtrim(preg_replace('/(\\/\\/*\\.)?\\/\\/*/', '/', $path), '/');
}