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

@return bool
171321
public function deleteFile($containerName, $fileName, $relativePath)
    {
        return $this->fileUploadFacade->deleteFile($containerName, $fileName, $relativePath);
    }
1163678
public function folderExists($container, $path)
    {
        $path = FileUtilities::fixFolderPath($path);
        $dir = static::addContainerToName($container, $path);

        return is_dir($dir);
    }
791749
public static function write($filename, $data, $permission = 0777, $flags = LOCK_EX, $relative = true) {
		// if we have relative path we convert it to full path
		if ($relative && $filename[0] == '.') {
			$path = \Application::get('application.path_full');
			$info = pathinfo($filename);
			$filename = realpath($path . $info['dirname']) . DIRECTORY_SEPARATOR . $info['basename'];
		}
		// write file
		if (file_put_contents($filename, $data, $flags) !== false) {
			@chmod($filename, $permission);
			return true;
		}
		return false;
	}
503340
public function isStaticFile($sitePath, $siteName, $uri)
    {
        if (file_exists($staticFilePath = $sitePath.'/public'.$uri)
           && is_file($staticFilePath)) {
            return $staticFilePath;
        }

        $storageUri = $uri;

        if (strpos($uri, '/storage/') === 0) {
            $storageUri = substr($uri, 8);
        }

        if ($this->isActualFile($storagePath = $sitePath.'/storage/app/public'.$storageUri)) {
            return $storagePath;
        }

        return false;
    }
1220572
public function resolvePath(string $relativePath): string
    {
        $path     = [];
        $absolute = (strpos($relativePath, '/') === 0);
        foreach (explode('/', $relativePath) as $part) {
            // ignore parts that have no value
            if (empty($part) || $part === '.') {
                continue;
            }

            if ($part !== '..') {
                $path[] = $part;
                continue;
            }
            if (count($path) > 0) {
                // going back up? sure
                array_pop($path);
                continue;
            }
            throw new \RuntimeException('Relative path resolves above root path.');
        }

        $return = implode('/', $path);
        if ($absolute) {
            $return = "/$return";
        }

        return $return;
    }
674560
public function withFileToSend($filePath, $attachmentName = null, $attachment = false)
    {
        if (!is_string($attachmentName)) {
            $basePath = basename($filePath);
        } else {
            $basePath = $attachmentName;
        }

        $this->file = $filePath;

        if ($attachment) {
            return $this->withHeader('Content-Description', 'File Transfer')
                ->withHeader('Content-Disposition', 'attachment; filename="' . $basePath . '"')
                ->withHeader('Content-Transfer-Encoding', 'binary');
        }

        return $this;
    }
1012314
public function listFilesByContainerName($containerName)
    {
        $files = [];
        foreach ($this->filesystem->listContents($containerName, true) as $file) {
            $file['mapped_path'] = sprintf('%s/%s', $this->baseUrl, $file['path']);

            if (array_key_exists('size', $file)) {
                $file['size_human'] = FileSize::convertToHumanReadable($file['size']);
            }

            $files[] = $file;
        }

        return $files;
    }
384255
public function fileExists($containerName, $fileName, $relativePath)
    {
        $fullFileName = $this->getFullFileName($containerName, $fileName, $relativePath);

        return $this->filesystem->has($fullFileName);
    }
315881
public function handle($absolutePath, $relativePath)
    {
        $sharedFiles = $this->getSharedFiles();

        $md5 = md5_file($absolutePath);
        if (isset($sharedFiles[$md5])) {
            \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' linked to shared storage.');
            return $sharedFiles[$md5];
        }

        SharedStimulusImporter::isValidSharedStimulus($absolutePath);
        $newXmlFile = SharedStimulusPackageImporter::embedAssets($absolutePath);
        $itemContent = $this->sharedStorage->add($newXmlFile, basename($relativePath), $this->parentPath);

        if (method_exists($this->sharedStorage, 'forceMimeType')) {
            $asset = $this->itemSource->resolve($itemContent['uri']);
            $this->sharedStorage->forceMimeType($asset->getMediaIdentifier(), 'application/qti+xml');
        }

        $this->addSharedFile($md5, $itemContent);
        \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' added to shared storage.');

        return $itemContent;
    }
775193
public function saveFile($containerName, \SplFileInfo $file, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->saveFile($containerName, $file, $relativePath);
    }
1033844
public function holdLock(GitUserInterface $user, FilePath $relativeFilePath)
    {
        return $this->lockService->holdLockForUser($user, $relativeFilePath);
    }
1205126
public function absolute($relativePath = null)
    {
        if ($this->isEmptyPath($relativePath)) {
            return $this->basePath;
        }

        if ($this->startsWithBasePath($relativePath)) {
            return $relativePath;
        }

        if (!$baseUrl = $this->getBaseUrl()) {
            return $this->basePath.'/'.trim($relativePath, '/');
        }

        if ($this->startsWithBaseUrl($relativePath)) {
            return $this->absolute($this->relative($relativePath));
        }

        return $this->basePath.'/'.trim($relativePath, '/');
    }
382326
@Override
    protected boolean hasChildren(final String relative) throws IOException {
        ZipFile zip = createZipFile();
        if (null == zip) {
            return false;
        }
        Enumeration<? extends ZipEntry> entries = zip.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = entries.nextElement();
            if ((relative.equals("")) || entry.getName().startsWith(relative + File.separator)) {
                return true;
            }
        }

        zip.close();
        return false;
    }
1367748
public function addPath($relativePath)
    {
        if (!$relativePath || $relativePath == '/') {
            return $this;
        }

        // Add a leading slash if needed
        if ($relativePath[0] != '/') {
            $relativePath = '/' . $relativePath;
        }

        return $this->setPath(str_replace('//', '/', $this->getPath() . $relativePath));
    }
9245
public function send_relative_file($relativepath) {
        if ($this->repository && $this->repository->supports_relative_file()) {
            $relativepath = clean_param($relativepath, PARAM_PATH);
            $this->repository->send_relative_file($this, $relativepath);
        } else {
            send_file_not_found();
        }
    }
917623
def resolve(self, container: Container, fn: str) -> str:
        
        bug = self.__mgr_bug[container.bug]
        fn_orig = fn

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

        return fn
550237
public function deleteFile($containerName, $fileName, $relativePath)
    {
        $fullFileName = $this->getFullFileName($containerName, $fileName, $relativePath);

        return $this->filesystem->delete($fullFileName);
    }