@param string $containerName
@param \SplFileInfo $file
@param string|null $relativePath

@return bool
775193
public function saveFile($containerName, \SplFileInfo $file, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->saveFile($containerName, $file, $relativePath);
    }
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.');
        }
    }
1092635
public function readFileStream($containerName, $fileName, $relativePath)
    {
        return $this->fileUploadFacade->readFileStream($containerName, $fileName, $relativePath);
    }
189088
public static String relativePath(File parent, File child) {
        Path superPath = parent.toPath();
        Path subPath = child.toPath();
        if (!subPath.startsWith(superPath)) {
            throw new IllegalArgumentException("Not a subpath: " + child);
        }
        return superPath.relativize(subPath).toString();
    }
651436
public function filter(\SplFileInfo $file)
    {
        foreach ($this->filter as $filter) {
            if ($filter->filter($file)) {
                return true;
            }
        }
        return false;
    }
847883
protected function failIfContainerNotFound(ServiceException $exception, $action, $containerName)
    {
        $errorCode = $this->getErrorCodeFromServiceException($exception);

        if ($errorCode === self::ERROR_CONTAINER_NOT_FOUND) {
            throw new \RuntimeException(sprintf(
                'Failed to %s: container "%s" not found.',
                $action,
                $containerName
            ), $exception->getCode());
        }
    }
157670
public function resolveRelativePath(string $basePath, string $relativePath) : string
    {
        if (strpos($relativePath, 'data://') === 0) {
            return $relativePath;
        }

        list($basePathStreamWrapper, $basePath) = $this->splitStreamWrapperAndPath($basePath);
        list($relativeStreamWrapper, $relativePathWithoutStreamWrapper) = $this->splitStreamWrapperAndPath($relativePath);

        $isAbsolutePath = $relativeStreamWrapper !== null;

        if ($isAbsolutePath) {
            return $relativePath;
        } else {
            $relativePath = $relativePathWithoutStreamWrapper;
        }

        $basePath     = str_replace('\\', '/', $basePath);
        $relativePath = str_replace('\\', '/', $relativePath);

        if (substr($basePath, -1) !== '/') {
            $basePath .= '/';
        }

        if (strpos($relativePath, '.') === false) {
            return ($basePathStreamWrapper ? $basePathStreamWrapper . '://' : '')
            . PathHelper::normalize(str_replace('//', '/', $basePath . '/' . $relativePath));
        }

        $parts          = explode('/', $basePath);
        $relativeParts  = explode('/', trim($relativePath, '/'));
        $isDrivePath    = substr($basePath, 1, 1) === ':';
        $precedingSlash = $basePathStreamWrapper || $isDrivePath ? '' : '/';
        $trailingSlash  = !$basePathStreamWrapper && substr($relativePath, -1) === '/' ? '/' : '';

        foreach ($parts as $key => $part) {
            if ($part === '') {
                unset($parts[$key]);
            }
        }

        foreach ($relativeParts as $part) {
            if ($part === '.') {
                continue;
            } elseif ($part === '..') {
                array_pop($parts);
            } elseif ($part !== '') {
                $parts[] = $part;
            }
        }

        return ($basePathStreamWrapper ? $basePathStreamWrapper . '://' : '')
        . PathHelper::normalize($precedingSlash . implode('/', $parts) . ($parts ? $trailingSlash : ''));
    }
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;
    }
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);
    }
1264451
public function isApplicable($relativePath)
    {
        $xincluded = array();
        /** @var Element $xincludeElement */
        foreach ($this->getQtiItem()->getComposingElements('oat\taoQtiItem\model\qti\Xinclude') as $xincludeElement) {
            $xincluded[] = $xincludeElement->attr('href');
            \common_Logger::i("Xinclude component found in resource '" .
                $this->getQtiItem()->getIdentifier() . "' with href '" . $xincludeElement->attr('href') . "'.");
        }

        return in_array($relativePath, $xincluded);
    }
59748
protected function _filterFile(SplFileInfo $fileInfo)
    {
        if (!$fileInfo->isFile()) {
            return false;
        }

        if (($expr = $this->_getFilenameRegex()) && !preg_match($expr, $fileInfo->getPathname())) {
            return false;
        }

        if (($callback = $this->_getCallbackFilter()) && !call_user_func_array($callback, array($fileInfo))) {
            return false;
        }

        return true;
    }
457170
public function fileExists($containerName, $fileName, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->fileExists($containerName, $fileName, $relativePath);
    }
553394
def _resolve_path(self, container: Container, filepath: str) -> str:
        
        bug = self.__mgr_bug[container.bug]
        filepath_orig = filepath

        if not os.path.isabs(filepath):
            filepath = os.path.join(bug.source_dir, filepath)
            logger.debug("converted relative path to absolute path: %s -> %s",
                         filepath_orig, filepath)

        return filepath
1348252
protected function match(SplFileInfo $file): bool
    {
        return $file->isFile() &&
                $this->hasExtension($file) &&
                $this->instanceOf($file)
        ;
    }
469907
public function checkEnoughStorageSpaceLeft(Workspace $workspace, \SplFileInfo $file)
    {
        $workspaceManager = $this->container->get('claroline.manager.workspace_manager');
        $workspaceDir = $workspaceManager->getStorageDirectory($workspace);
        $fileSize = filesize($file);
        $allowedMaxSize = $this->ut->getRealFileSize($workspace->getMaxStorageSize());
        $currentStorage = $this->ut->getRealFileSize($workspaceManager->getUsedStorage($workspace));

        return ($currentStorage + $fileSize > $allowedMaxSize) ? false: true;
    }
416173
public static function langParser($filePath, $relativePath = '')
	{
		$lang = [];
		$parsed = self::arrayParser($relativePath . $filePath);

		foreach ($parsed as $parse)
		{
			$lang = array_merge($lang, $parse);
		}

		return $lang;
	}
495709
public function readFileStream($containerName, $fileName, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->readFileStream($containerName, $fileName, $relativePath);
    }