Formats a directory path to a uniform representation.
Basically formatPath but with a trailing slash.

@param string|string[] $pathOrPaths
@param string[] $additionalPaths
@return string
338089
public static function formatDirectory($pathOrPaths, ...$additionalPaths)
    {
        $directory = self::formatPath($pathOrPaths, ...$additionalPaths);

        if ($directory) {
            $directory = rtrim($directory, "/") . "/";
        }

        return $directory;
    }
1097453
public function flushPaths(array $paths)
    {
        if (empty($paths)) {
            throw new \RuntimeException('Unable to flush : expected at least one path');
        }
        // Normalizes paths due possible typos since all the CloudFront's
        // objects starts with a leading slash
        $normalizedPaths = array_map(static function ($path) {
            return '/'.ltrim($path, '/');
        }, $paths);

        try {
            $result = $this->getClient()->createInvalidation([
                'DistributionId' => $this->distributionId,
                'Paths' => [
                    'Quantity' => \count($normalizedPaths),
                    'Items' => $normalizedPaths,
                ],
                'CallerReference' => $this->getCallerReference($normalizedPaths),
            ]);

            if (!\in_array($status = $result->get('Status'), ['Completed', 'InProgress'], true)) {
                throw new \RuntimeException('Unable to flush : '.$status);
            }

            return $result->get('Id');
        } catch (CloudFrontException $ex) {
            throw new \RuntimeException('Unable to flush : '.$ex->getMessage());
        }
    }
70129
public static function appendPath($path)
    {
        $path = str_replace('//', '/', rtrim($path, '/'));
        if (is_dir($path) && !in_array($path, self::$_paths)) {
            array_push(self::$_paths, $path);
        }
    }
897268
public static function combinePath(...$paths)
    {
        //$paths=func_get_args();
        $value="";
        for($i=0;$i<count($paths);$i++){
            $path=$paths[$i];
            if($i>0){
                $value.="/";
                $path=ltrim($path,"/");
            }
            if($i<count($paths)-1){
                $path=rtrim($path,"/");
            }
            $value.=$path;
        }
        return $value;
    }
827435
function path2FolderName(filePath, keepTailSlash){
		var pathSegs = filePath.split("/");
		pathSegs.splice(pathSegs.length -1, 1);
		return keepTailSlash ? pathSegs.join("/") + "/" : pathSegs.join("/");
	}
1073268
public function loadFromFile($additionalPath = '')
    {
        $path = $this->testPath($this->realPath($additionalPath));
        
        if ($path === false) {
            return '';
        }
        
        return file_get_contents($path);
    }
542644
protected function makeDir($paths = '')
    {
        foreach ((array) $paths as $path) {
            $path = $this->extensionPath($path);

            $this->filesystem->makeDirectory($path, 0755, true, true);
        }
    }
414616
public function fixWindowsPath($path, $addEndSlash = false){
		$slash = ($addEndSlash) ? '/' : '';
		if( !empty($path) ){
			$path = str_replace('\\', '/', $path);
			$path = rtrim($path,'/') . $slash;
		}

		return $path;
	}
1267242
public static function concat($paths)
    {
        $returnValue = (string) '';

        foreach ($paths as $path){
        	if (!preg_match("/\/$/", $returnValue) && !preg_match("/^\//", $path) && !empty($returnValue)){
        		$returnValue .= '/';
        	}
        	$returnValue .= $path;
        }
        $returnValue = str_replace('//', '/', $returnValue);

        return (string) $returnValue;
    }
525936
private static String formatPathToDir(Path path) {
    return path.toString().endsWith(Path.SEPARATOR) ? path.toString() : path.toString() + Path.SEPARATOR;
  }
172436
protected function bindPathsInContainer(array $otherPaths)
    {
        $defaultPaths = [
            'base'    => $this->basePath,
            'env'     => $this->basePath,
            'app'     => $this->basePath . DIRECTORY_SEPARATOR . 'app',
            'config'  => $this->basePath . DIRECTORY_SEPARATOR . 'config',
            'storage' => $this->basePath . DIRECTORY_SEPARATOR . 'storage',
            'logs'    => $this->basePath . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . 'logs',
        ];

        $paths = array_merge($defaultPaths, $otherPaths);
        $this->instance('path', rtrim(array_pull($paths, 'app'), '\/'));

        foreach ($paths as $key => $path) {
            $this->instance("path.{$key}", rtrim($path, '\/'));
        }
    }
603016
public function setPaths($paths)
    {
        $paths = (array)$paths;
        //Append framework's view path
        $paths[] = realpath(__DIR__ . '/../../views');

        $this->paths = $paths;
        return $this;
    }
865334
public static function normalizePath($path, $ds = DIRECTORY_SEPARATOR)
	{
		if (!is_string($path) && !empty($path))
		{
			throw new \InvalidArgumentException('$path is not a string.');
		}

		$path = trim($path);

		// Remove any kind of funky unicode whitespace
		$path = preg_replace('#\p{C}+|^\./#u', '', $path);

		if (empty($path))
		{
			$path = PATH_ROOT;
		}
		// Remove double slashes and backslashes and convert all slashes
		// and backslashes to DIRECTORY_SEPARATOR. If dealing with a UNC
		// path don't forget to prepend the path with a backslash.
		else if ($ds == '\\' && $path[0] == '\\' && $path[1] == '\\')
		{
			$path = "\\" . preg_replace('#[/\\\\]+#', $ds, $path);
		}
		else
		{
			$path = preg_replace('#[/\\\\]+#', $ds, $path);
		}

		return $path;
	}
26951
public static function normalizePath($path, $endSlash = true)
    {
        $path = rtrim($path, '/') . DIRECTORY_SEPARATOR;
        $path = rtrim($path, DIRECTORY_SEPARATOR);

        $path = $endSlash ? $path . DIRECTORY_SEPARATOR : $path;

        return $path;
    }
825706
public function isWritable($additionalPath = '')
    {
        $path = $this->realPath($additionalPath);
        
        if ($path === false || !is_writable($path)) {
            return false;
        }
        
        return true;
    }
951838
public static function normalizePath( $path )
    {
        if ( '\\' == DIRECTORY_SEPARATOR )
        {
            if ( isset( $path, $path[1], $path[2] ) && ':' === $path[1] && '\\' === $path[2] )
            {
                if ( false !== strpos( $path, '/' ) )
                {
                    $path = str_replace( '/', DIRECTORY_SEPARATOR, $path );
                }
            }
        }

        return $path;
    }
1368154
public function concat($paths)
    {
        if (is_array($paths))
            $paths = implode('/', $paths);
        return $this->fullPath() . '/' . $paths;
    }