Create a new path on top of a base directory
@param string $base
@param string $path
@return boolean
164356
public function createPath($base, $path)
    {
        if (!is_dir($base) || !is_writable($base)) {
            return false;
        }

        if (empty($path)) {
            return false;
        }

        $pieces = explode(self::DS, $path);
        $dir = $base;
        foreach ($pieces as $directory) {
            if (empty($directory)) {
                // @codeCoverageIgnoreStart
                continue; // Handle the / from the exploded path
                // @codeCoverageIgnoreEnd
            }

            $singlePath = $dir . self::DS . $directory;
            if (!file_exists($singlePath) || !is_dir($singlePath)) {
                $create = @mkdir($singlePath);
                if ($create === false) {
                    // @codeCoverageIgnoreStart
                    return false;
                    // @codeCoverageIgnoreEnd
                }
            }
            $dir = $singlePath;
        }

        return true;
    }
738106
public static function createFromPath($path, array $replaces = [])
    {
        return tap(new static($path, $replaces), function (self $stub) {
            $stub->setBasePath('');
        });
    }
938188
public function toRelative(\Coast\Path $base)
    {
        if (!$this->isAbsolute() || !$base->isAbsolute()) {
            throw new \Exception("Source path '{$this}' is not absolute or base path '{$base}' is not absolute");
        }
        
        $source = explode('/', (string) $base);
        $target = explode('/', $this->_name);

        $name = $target;
        foreach ($source as $i => $part) {
            if ($part == $target[$i]) {
                array_shift($name);
            } else {
                $name = array_pad($name, (count($name) + (count($source) - $i) - 1) * -1, '..');
                break;
            }
        }
        $name = implode('/', $name);

        $class = get_class($this);
        return new $class($name);
    }
1002590
protected function newPath(/*# string */ $path)/*# : Path */
    {
        list($mnt, $remain) = $this->splitPath($path);
        return new Path($path, $remain, $this->getFilesystemAt($mnt));
    }
752548
public function setBasePath($path)
    {
        if (($this->_basePath = realpath($path)) === false || !is_dir($this->_basePath)) {
            throw new Exception(Mindy::t('base', 'Application base path "{path}" is not a valid directory.', ['{path}' => $path]));
        }
    }
472218
public function setPath($path)
	{
		if($path !== false)
			$path = trim($path, '/');

		$this->setProperty('path', $path);

		return $this;
	}
797870
public static function createFromPath($path)
    {
        if (!file_exists($path)) {
            throw new Exception\FactoryException(sprintf('Unable to open file %s', $path));
        }
        $file = new \SplFileInfo($path);
        return static::createFromSplFileInfo($file);
    }
998947
public function setBasePath($path)
    {
        $this->basePath = $path;

        array_unshift($this->paths, $this->basePath);
    }
1144275
protected function getNestPath($path, $base)
    {
        $ds = preg_quote(DIRECTORY_SEPARATOR, '#');

        return preg_replace(
            // patterns to remove
            array(
                // strip the leading path (make it relative to the
                // root of the service description)
                '#^' . preg_quote($base, '#') . $ds . '#',

                // Ignore trailing __index.foo
                '#^(.*?)(:?' . $ds . '?__index)?\\.(:?\\w+)$#',

                // Remove path components ending with .group
                '#\\w+\\.group(' . $ds . '|$)#',

                // Remove any trailing slash
                '#' . $ds . '+$#',

                // Translate any remaining backslash delimiters (Windows)
                '#\\\\#'
            ),
            // replacements (corresponding with patterns above)
            array(
                '',
                '\\1',
                '',
                '',
                '/'
            ),
            $path
        );
    }
99719
public static function createFromPath($path, $workingDirectory)
    {
        if ( ! file_exists($path) || ! is_file($path)) {
            throw new \InvalidArgumentException("Not a valid file: " . $path);
        }

        $code = file_get_contents($path);
        $workingDirectory = rtrim($workingDirectory, '/\\');
        $relativePath = ltrim(str_replace($workingDirectory, "", $path), "/\\");

        // converted mixed, wrapped, absolute paths on windows
        if (DIRECTORY_SEPARATOR === '\\' && strpos($relativePath, '://') !== FALSE) {
            $relativePath = str_replace('\\', '/', $relativePath);
        }

        return new self($relativePath, $code);
    }
593125
public static function createFromPath($path)
    {
        if (!is_dir($path) || !is_readable($path)) {
            throw new \LogicException(sprintf('%s does not exist or is not readable.', $path));
        }

        return static::createFromFilesystem(new Filesystem(new Local($path)));
    }
231709
public function createDir( $path )
    {
        if ( empty( $path ) )
        {
            return false;
        }

        $path = $this->validPath( $path );
        $base = $this->baseUrl . '/' . $path;
        $full = $this->baseDir . '/' . $base;

        if ( ! is_dir( $full ) && ! is_file( $full ) )
        {
            $rights = $this->rights( $path );

            if ( $rights->write && @ mkdir( $full, 0777, true ) )
            {
                return $path;
            }
        }

        return false;
    }
594158
public function addPath($path)
	{
		$path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
		$this->finder->addPath($path);

		if ($this->environment)
		{
			$this->finder->addPath($path.$this->environment);
		}

		return $this;
	}
96885
public function file($path)
    {
        if (!isset($this->_baseDir)) {
            throw new App\Exception('Base directory not set');
        }
        return $this->_baseDir->file($path);
    }
562255
public function basePath($basePath = null)
    {
        if (!func_num_args()) {
            return $this->_basePath;
        }
        $this->_basePath = $basePath;
        return $this;
    }
1025953
private function mergeBasePath()
    {
        if (null !== $this->baseUri->authority && '' === $this->baseUri->path) {
            $this->path = '/' . $this->path;
        } else {
            if (false !== $lastSlashPos = strrpos($this->baseUri->path, '/')) {
                $basePath = substr($this->baseUri->path, 0, $lastSlashPos + 1);
                $this->path = $basePath . $this->path;
            }
        }
    }
841748
public function basePath($path = '')
    {
        return $this->getFilesystem()->dirname($this->path()) . ($path ? DIRECTORY_SEPARATOR . $path : $path);
    }