Lines Matching refs:path

11  * A local file system path
22 * The characters that cannot be in the path for windows
39 throw new ExceptionBadArgument("$uri is not a local path uri");
49 public static function createFromPathObject(Path $path): LocalPath
51 if ($path instanceof LocalPath) {
52 return $path;
54 if ($path instanceof WikiPath) {
55 return $path->toLocalPath();
57 throw new ExceptionBadArgument("The path is not a local path nor a wiki path, we can't transform it");
75 private $path;
85 * @param string $path - relative or absolute, or a locale file uri
86 * @param string|null $sep - the directory separator - it permits to test linux path on windows, and vice-versa
88 public function __construct(string $path, string $sep = null)
95 if (strpos($path, LocalFileSystem::SCHEME.'://') === 0) {
97 $path = Url::createFromString($path)->getPath();
98 LogUtility::errorIfDevOrTest("The path given as constructor should not be an uri or a path object");
100 LogUtility::internalError("The uri path could not be created", self::CANONICAL, $e);
108 if (substr($path, 0, 2) === $networkShare) {
110 $pathWithoutNetworkShare = substr($path, 2);
113 $this->path = "/$relativePath";
116 $this->path = self::normalizeToOsSeparator($path);
131 * @param $path
137 * Because we want to be able to copy the path value and to be able to use
140 private function normalizeToOsSeparator($path)
142 if ($path === self::RELATIVE_CURRENT || $path === self::RELATIVE_PARENT) {
143 return realpath($path);
147 return str_replace(self::LINUX_SEPARATOR, self::WINDOWS_SEPARATOR, $path);
149 return str_replace(self::WINDOWS_SEPARATOR, self::LINUX_SEPARATOR, $path);
184 throw new ExceptionNotFound("No last name for the path ($this)");
193 $extension = pathinfo($this->path, PATHINFO_EXTENSION);
195 throw new ExceptionNotFound("No extension found for the path ($this)");
203 return explode($directorySeparator, $this->path);
209 return $this->path;
214 $absolutePath = pathinfo($this->path, PATHINFO_DIRNAME);
215 if ($absolutePath === $this->path || empty($absolutePath)) {
235 * @throws ExceptionBadArgument - if the path is not inside a drive
251 * @throws ExceptionBadArgument - if the path cannot be relativized
265 * (if the path is logically not absolute and is a symlink,
296 throw new ExceptionBadArgument("The path ($localPath) is not a parent path of the actual path ($actualPath)");
306 if (preg_match("/^(\/|[a-z]:\\\\?).*/i", $this->path)) {
314 * An absolute path may not be canonical
315 * (ie windows short name or the path separator is not consistent (ie / in place of \ on windows)
317 * This function makes the path canonical meaning that two canonical path can be compared.
318 * This is also needed when you path a path string to a php function such as `clearstatcache`
320 * If this is a symlink, it will resolve it to the real path
327 * real path handle also the windows name ie USERNAME~
330 $realPath = realpath($this->path);
365 $workingPath = $this->path;
395 $message = "Bad absolute local path file ($this->path)";
428 * file://host/path
437 $pathNormalized = str_replace(self::WINDOWS_SEPARATOR, self::LINUX_SEPARATOR, $this->path);
467 return is_link($this->path);
474 * https://datacadamia.com/os/windows/path#pathname
476 return strpos($this->path, "~1") !== false;