Search for a relative path within the search directories.

@param string $path Relative path

@return string
554953
protected function _findPath($path)
    {
        $path = $this->_unifyPath($path);
        $dirs = $this->_dirs;

        $file = null;

        foreach ($dirs as $dir) {
            if (is_readable(realpath($dir.DS.$path))) {
                $file = $dir.DS.$path;
                break;
            }
        }

        return $file;
    }
462785
protected function findBasePath(string $path): ?string
    {
        preg_match('#^.+/(vendor|spryker)/.+/src/#', $path, $matches);
        if (!$matches) {
            return null;
        }

        return rtrim($matches[0], DIRECTORY_SEPARATOR);
    }
1011179
protected function rewriteTargetPath($path)
    {
        if (strpos($path, JPATH_ROOT) === 0) {
            $path = self::$resourceLocator->rewrite(
                $this->relativeJoomlaTargetPath($path)
            );
        }

        return $path;
    }
1020361
public static function relativePath($path)
    {
        $base = self::normalizePath(Director::baseFolder());
        
        return substr($path, strlen($base));
    }
787325
public function getPath(string $path = ''): string
    {
        return $this->dirPath.($path ? DIRECTORY_SEPARATOR.$path : $path);
    }
895422
public function getRelativeProjectPath(string $path): string
    {
        $realPath = $this->getAbsolutePath($path);
        $gitPath = $this->getAbsolutePath($this->getGitDir());

        if (0 !== strpos($realPath, $gitPath)) {
            return $realPath;
        }

        return rtrim($this->getRelativePath($realPath), '\\/');
    }
792091
public function rootPath($path = '')
    {
        if (defined('THEMOSIS_ROOT')) {
            return THEMOSIS_ROOT.($path ? DIRECTORY_SEPARATOR.$path : $path);
        }

        return $this->webPath($path);
    }
362771
private static function find($path)
    {
        $view_path = null;
        foreach (self::$directories as $directory) {
            $formatted_path = self::formatPath($directory . '/' . $path);
            if (self::isValidPath($formatted_path)) {
                $view_path = $formatted_path;
                break;
            }
        }
        
        if (empty($view_path)) {
            if (self::$report_errors) {
                die('View not found: ' . $view_path);
            }
            return null;
        }
        
        return $view_path;
    }
377427
protected function makeDirectory($path): string
    {
        if (! $this->files->isDirectory($path)) {
            $this->files->makeDirectory($path, 0777, true, true);
        }

        return $path;
    }
602291
public static function getRealPath($path)
    {
        $path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);

        return rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
    }
812901
public function locatePath($path)
    {
        if (stripos($path, 'http') === 0) {
            return $path;
        }

        $url = $this->getMinkParameter('base_url');

        if (strpos($path, 'wp-admin') !== false || strpos($path, '.php') !== false) {
            $url = $this->getWordpressParameter('site_url');
        }

        return rtrim($url, '/') . '/' . ltrim($path, '/');
    }
39784
protected function findAbsolutePath($path)
    {
        if (is_file($path) || is_dir($path)) {
            return realpath($path);
        }

        if (null === $this->basePath) {
            return false;
        }

        if (is_file($this->basePath . DIRECTORY_SEPARATOR . $path)
               || is_dir($this->basePath . DIRECTORY_SEPARATOR . $path)) {
            return realpath($this->basePath . DIRECTORY_SEPARATOR . $path);
        }

        return false;
    }
697129
public static function getParentPath($path)
    {
        if ($path === '/') {
            $parentPath = '';
        } elseif (strrpos($path, '/') === 0) {
            $parentPath = '/';
        } else {
            $parentPath = substr($path, 0, strrpos($path, '/'));
        }

        return $parentPath;
    }
58031
protected function getPath($path)
	{
		$paths = array();

		// If `$path` is an array
		if (is_array($path))
		{
			foreach ($path as $unverifiedPath)
			{
				$paths = array_merge($paths, $this->getPath($unverifiedPath));
			}

			return $paths;
		}

		// If `$path` is a directory
		if (is_dir($path))
		{
			$paths = glob($path . '/*.*');

			return $paths;
		}

		// If `$path` is a file
		if (file_exists($path))
		{
			$paths[] = $path;
		}

		return $paths;
	}
664554
protected function path($path)
    {
        if (strpos($path, './') === 0) {
            return $this->dir . '/' . substr($path, 2);
        }

        if (strpos($path, '../') === 0) {
            return dirname($this->dir) . '/' . substr($path, 3);
        }

        return $path;
    }
240616
protected static function getSlug($path, $relativePath)
    {
        if (string_starts_with($path, $relativePath)) {
            $path = substr($path, strlen(Folder::slashTerm($relativePath)));
        }
        $path = preg_replace(sprintf('/\.[^\.]+$/'), null, $path);

        return DS == '/' ? $path : str_replace(DS, '/', $path);
    }
521132
public static function relative($path)
    {
        // windows fix :/
        $path = str_replace('\\', '/', $path);

        // standard working directory
        if (strpos($path, WWW_DIR) !== false) {
            return str_replace(WWW_DIR, '', $path);
        }

        // symlink
        $pos = strpos($path, 'upload/');

        return substr($path, $pos - 1);
    }