ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCloudUtil.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
15{
16
22 public static function normalizePath($path)
23 {
24 if ($path == "." || $path == "/" || $path == "") {
25 $path = "/";
26 } else {
27 $path = "/" . rtrim(ltrim(str_replace('//', '/', $path), "/"), "/");
28 }
29
30 return $path;
31 }
32
33
40 public static function joinPaths($path1, $path2)
41 {
42 $path1 = ilCloudUtil::normalizePath($path1);
43 $path2 = ilCloudUtil::normalizePath($path2);
44
45 return ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
46 }
47
48
57 public static function joinPathsAbsolute($path1, $path2)
58 {
59 $path = ilCloudUtil::normalizePath(str_replace('//', '/', $path1 . $path2));
60 if ($path == "/") {
61 return $path;
62 } else {
63 return "/" . ltrim($path, "/") . "/";
64 }
65 }
66}
An exception for terminatinating execution or to throw for unit testing.
Class ilCloudUtil.
static normalizePath($path)
static joinPathsAbsolute($path1, $path2)
With trailing and leading slashes.
static joinPaths($path1, $path2)