@param string $containerName
@param string $fileName
@param string|null $relativePath

@return false|resource
495709
public function readFileStream($containerName, $fileName, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->readFileStream($containerName, $fileName, $relativePath);
    }
907496
public function setJSFromFile(string $filename, Scopable $scope = null, bool $relativeToRootPath = true): void
    {
        $this->jsElement = new HtmlFromFile($filename, $scope, $relativeToRootPath);
    }
376106
public function getPath($relativePath, $fileName = null, $ext = '.php')
    {
        $path = Path::join($this->dir, $relativePath);

        return is_null($fileName) ? $path : Path::join($path, $fileName . $ext);
    }
274960
@Override
    public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException {
        throw new FileNotFoundException("Cannot create a relative resource for " + getDescription());
    }
863323
public function getRelativeAsset (string $relativePath) : ?self
    {
        $filePath = new FilePath();

        return new self(
            $this->getNamespace(),
            $filePath->resolvePath($this->getFilePath(), $relativePath)
        );
    }
278467
private function createLoader(ContainerBuilder $container, string $basePath): LoaderInterface
    {
        $fileLocator = new FileLocator($basePath);
        $loader = new DelegatingLoader(new LoaderResolver([
            new Loader\XmlFileLoader($container, $fileLocator),
            new Loader\YamlFileLoader($container, $fileLocator),
            new Loader\PhpFileLoader($container, $fileLocator),
            new Loader\GlobFileLoader($container, $fileLocator)
        ]));

        return $loader;
    }
115351
private function getFinder($fileName, ContainerBuilder $container)
    {
        $finder       = (new Finder())->files()->name($fileName);
        $resourcesDir = 'Resources'.DIRECTORY_SEPARATOR.'config';

        if (self::$directoriesCache) {
            return $finder->in(self::$directoriesCache);
        }

        foreach ($container->getParameter('kernel.bundles') as $name => $pathToBundle) {
            try {
                $reflector = new \ReflectionClass($pathToBundle);
            } catch (\ReflectionException $e) {
                continue;
            }

            $fileName = $reflector->getFileName();
            $fileName = str_replace($name.'.php', $resourcesDir, $fileName);

            try {
                $finder->in($fileName);
                self::$directoriesCache[$name] = $fileName;
            } catch (\InvalidArgumentException $e) {
                // remove invalid directories
                unset(self::$directoriesCache[$name]);
            }
        }

        return $finder;
    }
984106
public static function getUrlPathFromFilePath($filePath, $relativeToRootUrl = false) {
		$dir = $filePath;
		$rootPath = ROOT_PATH;
		
		if (strpos($dir, ROOT_PATH) === 0) {
			$dirUrl = ROOT_URL.substr(ROOT_PATH, strlen(__DIR__)+1);
		} else {
			// The directory URL is below the ROOT_URL. Let's try to find it (not 100% success rate)
			$rootPaths = explode(DIRECTORY_SEPARATOR, trim($rootPath, DIRECTORY_SEPARATOR));
			$thisDirs = explode(DIRECTORY_SEPARATOR, trim($dir, DIRECTORY_SEPARATOR));
		
			for ($i=0; $i<count($rootPaths); $i++) {
				if ($rootPaths[$i] != $thisDirs[$i]) {
					break;
				}
			}
		
			$nbSkip = count($rootPaths) - $i;
			$urls = explode('/', trim(ROOT_URL, '/'));
		
			if ($nbSkip > count($urls)) {
				throw new Exception('The directory "'.$dir.'" is almost certainly out of reach from the web.');
			}
		
			$dirUrls = array();
			for ($j=0; $j < count($urls)- $nbSkip; $j++) {
				$dirUrls[] = $urls[$j];
			}
			for ($k = $i; $k<count($thisDirs); $k++) {
				$dirUrls[] = $thisDirs[$k];
			}
			$dirUrl = '/'.implode('/', $dirUrls);
			
			if ($relativeToRootUrl) {
				$dirUrl = ltrim(str_repeat('/..', count($urls)).$dirUrl, '/');
			}
		}
		return $dirUrl;
	}
75804
public static function path($filename, $relativeTo = null, $checkExists = true, $ds = null)
    {
        $ds = $ds ?: DIRECTORY_SEPARATOR;

        if (is_array($filename)) {
            $pathnames = array();
            foreach ($filename as $k => $f) {
                $pathnames[$k] = self::path($f, $relativeTo, $checkExists);
            }
            return $pathnames;
        }

        $relativeTo = $relativeTo ?: self::$rootDirectory;
        $pathname = $filename;
        if ($filename{0} != '/' && !preg_match('#^[A-Z]:(\\\\|/)#', $filename)) {
            if (strlen($filename) >= 2 && substr($filename, 0, 2) == './') {
                $filename = substr($filename, 2);
            }
            $pathname = rtrim($relativeTo, $ds) . $ds . $filename;
        }
        if ($checkExists) {
            return realpath($pathname);
        }
        return $pathname;
    }
1237487
public function writeFile($container, $path, $content, $content_is_base = false, $check_exist = false)
    {
        // does this file already exist?
        if ($this->fileExists($container, $path)) {
            if (($check_exist)) {
                throw new InternalServerErrorException("File '$path' already exists.");
            }
        }
        // does this folder's parent exist?
        $parent = FileUtilities::getParentFolder($path);
        if (!empty($parent) && (!$this->folderExists($container, $parent))) {
            throw new NotFoundException("Folder '$parent' does not exist.");
        }

        // create the file
        $this->checkContainerForWrite($container); // need to be able to write to storage
        if ($content_is_base) {
            $content = base64_decode($content);
        }
        $file = static::addContainerToName($container, $path);
        $result = file_put_contents($file, $content);
        if (false === $result) {
            throw new InternalServerErrorException('Failed to create file.');
        }
    }
371051
@Override
    public Resource createRelative(String relativePath) {
        String pathToUse = ResourceUtils.applyRelativePath(path, relativePath);
        return new FileSystemResource(pathToUse);
    }
323359
public function documentExists(TransferInterface $transfer, $containerName)
    {
        return $this->getFactory()
            ->createPdfDocumentManager()
            ->documentExists($transfer, $containerName);
    }
646823
public function copyFile($container, $dest_path, $src_container, $src_path, $check_exist = false)
    {
        // does this file already exist?
        if (!$this->fileExists($src_container, $src_path)) {
            throw new NotFoundException("File '$src_path' does not exist.");
        }
        if ($this->fileExists($container, $dest_path)) {
            if (($check_exist)) {
                throw new BadRequestException("File '$dest_path' already exists.");
            }
        }
        // does this file's parent folder exist?
        $parent = FileUtilities::getParentFolder($dest_path);
        if (!empty($parent) && (!$this->folderExists($container, $parent))) {
            throw new NotFoundException("Folder '$parent' does not exist.");
        }

        // create the file
        $this->checkContainerForWrite($container); // need to be able to write to storage
        $file = static::addContainerToName($src_container, $dest_path);
        $srcFile = static::addContainerToName($container, $src_path);
        $result = copy($srcFile, $file);
        if (!$result) {
            throw new InternalServerErrorException('Failed to copy file.');
        }
    }
922208
protected function copyContentFromThemeToSite($sitePath, $relativeThemePath)
    {
        if ($this->fs->exists($sitePath.'/'.$relativeThemePath) === false) {
            throw new \RuntimeException('The theme has not been installed correctly.');
        }

        $finder = new Finder();
        $finder->in($sitePath.'/'.$relativeThemePath.'/src/content')
            ->exclude(['assets'])
            ->files();

        foreach ($finder as $file) {
            $this->fs->copy($file->getRealpath(), $sitePath.'/src/content/'.$file->getRelativePathname(), true);
        }
    }
760285
protected function getLockPath(FilePath $filePath)
    {
        $name = $filePath->getName();
        $relativeLockPath = $filePath->getParentPath()->appendFile('.' . $name . '.lock');

        return $relativeLockPath;
    }
33173
public function saveUploadedFile($containerName, UploadedFile $file, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->saveUploadedFile($containerName, $file, $relativePath);
    }
1076823
public function getFile($relativePath)
    {
        $fileKey = $this->getFileKey($this->getAbsolutePath($relativePath));

        return new File($fileKey, $this);
    }