public static function normalizePath($path, $rtrim = true){
		$path = trim($path);
		// replace every back slash with forward slash
		$path = str_replace('\\', '/', $path);
		// replace all double slashes with single
		$path  = preg_replace( '/\/+/', '==DS==', $path );
		// trim slashes on begining
		$segments = explode('==DS==', $path);
		$path = implode(DIRECTORY_SEPARATOR, $segments);
		//$path = ltrim($path, DIRECTORY_SEPARATOR);

		if($rtrim){
			$path = rtrim($path, DIRECTORY_SEPARATOR);
		}

		return $path;
	}