Either create local copy or use original location for tile
Returns absolute path to the file, to be compatible with legacy methods
@deprecated
@param string|File $serial
@return string
@throws \common_Exception
961182
public function getUploadedFile($serial)
    {
        $file = $this->universalizeUpload($serial);
        if ($file instanceof File) {
            $file = $this->getLocalCopy($file);
        }
        return $file;
    }
130858
public function getFile($remote, $local)
    {
        return ftp_get($this->connection, $local, $remote, $this->getTransferenceEncoding($remote));
    }
965143
public function setUp($serial)
    {

        // initialize the flag whether to copy images or not
        if ($this->getConfiguration()->hasParam(ConfigurationKeys::COPY_IMAGES)) {
            $this->setCopyImages($this->getConfiguration()->getParam(ConfigurationKeys::COPY_IMAGES));
        }

        // initialize media directory => can be absolute or relative
        if ($this->getConfiguration()->hasParam(ConfigurationKeys::MEDIA_DIRECTORY)) {
            $this->setMediaDir(
                $this->resolvePath(
                    $this->getConfiguration()->getParam(ConfigurationKeys::MEDIA_DIRECTORY)
                )
            );
        }

        // initialize images directory => can be absolute or relative
        if ($this->getConfiguration()->hasParam(ConfigurationKeys::IMAGES_FILE_DIRECTORY)) {
            $this->setImagesFileDir(
                $this->resolvePath(
                    $this->getConfiguration()->getParam(ConfigurationKeys::IMAGES_FILE_DIRECTORY)
                )
            );
        }

        // prepare the callbacks
        parent::setUp($serial);
    }
401801
protected function processExport(AbstractExport $export, SerializerInterface $serializer)
    {
        $filename = sprintf(
            '%s-%s-%s.%s',
            (new \DateTime)->format('Ymd'),
            uniqid(),
            $export->getFileName(),
            $serializer->getExtension()
        );

        $filePath = THELIA_CACHE_DIR . 'export' . DS . $filename;

        $fileSystem = new Filesystem;
        $fileSystem->mkdir(dirname($filePath));

        $file = new \SplFileObject($filePath, 'w+b');

        $serializer->prepareFile($file);

        foreach ($export as $idx => $data) {
            $data = $export->beforeSerialize($data);
            $data = $export->applyOrderAndAliases($data);
            $data = $serializer->serialize($data);
            $data = $export->afterSerialize($data);

            if ($idx > 0) {
                $data = $serializer->separator() . $data;
            }

            $file->fwrite($data);
        }

        $serializer->finalizeFile($file);

        unset($file);

        return $filePath;
    }
519875
public static function path($filename)
    {
        if ($filename[0] != "/") {
            $filename = static::$path . "/" . $filename;
        }

        if (substr($filename, -5) != ".json") {
            $filename .= ".json";
        }

        $path = pathinfo($filename, PATHINFO_DIRNAME);

        # Ensure the cache directory exists
        if (!is_dir($path)) {
            if (!mkdir($path, 0777, true)) {
                throw new \Exception("Unable to create cache directory (" . $path . ")");
            }
        }

        # Ensure directory is writable
        if (!is_writable($path)) {
            if (!chmod($path, 0777)) {
                throw new \Exception("Cache directory (" . $path . ") is not writable");
            }
        }

        return $filename;
    }
144385
public function getChoiceBySerial($serial){
        $returnValue = null;
        $choices = $this->getChoices();
        if(isset($choices[$serial])){
            $returnValue = $choices[$serial];
        }
        return $returnValue;
    }
1263531
public static function getRelativeFilepath($file)
    {
        $storageDir = self::convertSlashes(config('filer.path.absolute'));
        $absolutePath = self::convertSlashes($file->getRealPath());
        return dirname(str_replace($storageDir, '', $absolutePath));
    }
829468
protected function getOriginalFile($resource)
    {
        $file = null;
        $path = storage_path('app/' . $resource->path);

        if( ! File::exists($path) ) {
            HCLog::error('R-THUMB-001', 'File not found at path: ' . $path);
        } else if( $resource->isImage() || strpos($resource->mime_type, 'svg') !== false ) {
            $file = File::get($path);
        }

        return $file;
    }
299734
public function generateBaseDirectoryPath($config)
    {
        $base = $config->get('Cache.SerializerPath');
        $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
        return $base;
    }
184358
public function path($file = '', $theme = null)
    {
        if (is_null($theme)) {
            $theme = $this->getCurrent();
        }

        $theme = $this->format($theme);

        return base_path("themes/{$theme}/{$file}");
    }
46672
protected function _getImagePath($sType)
    {
        $sFolder = array_key_exists($sType, $this->_aTypeToPath) ? $this->_aTypeToPath[$sType] : '0';

        return $this->normalizeDir(\OxidEsales\Eshop\Core\Registry::getConfig()->getPictureDir(false)) . "{$sFolder}/";
    }
663341
protected function cleanSerial($serial)
    {
        if ($serial instanceof \core_kernel_classes_Resource) {
            $serial = $serial->getUri();
        } elseif ($serial instanceof \core_kernel_classes_Literal) {
            $serial = $serial->__toString();
        } elseif (!is_string($serial)) {
            throw new FileSerializerException('Unsupported serial "'.gettype($serial).'" in '.__CLASS__);
        }

        return $serial;
    }
219607
private function getRealFilePath( string $filePath ) : string
	{
		$realFilePath = getcwd() . DIRECTORY_SEPARATOR . ltrim( $filePath, '/' );
		$outputDir    = dirname( $realFilePath );
		if ( !@mkdir( $outputDir, 0777, true ) && !is_dir( $outputDir ) )
		{
			throw new InvalidArgumentException( 'Invalid file path: ' . $realFilePath );
		}

		return $realFilePath;
	}
984153
public function getPath()
    {
        $adapter = $this->getFileSystem()->getAdapter();
        if (!$adapter instanceof Local) {
            throw new common_exception_InconsistentData(__CLASS__.' can only handle local files');
        }
        return $adapter->getPathPrefix() . $this->getPrefix();
    }
1175360
protected function makeReleaseRelativePath(AbstractResourceFile $resource) {
        if (is_null($this->getReleaseDir())) {
            throw new FileWriteErrorException("The release dir configuration is missed for " . get_class($this));
        }
        return $resource->getRelativePath($this->getSourceDir());
    }
727502
public function getUploadedFlyFile($serial)
    {
        $path = $this->getUserDirectoryHash() . '/';
        if (filter_var($serial, FILTER_VALIDATE_URL)) {
            // Getting the File instance of the file url.
            $fakeFile = $this->getSerializer()->unserializeFile($serial);

            // Filesystem hack check.
            if ($fakeFile->getFileSystemId() !== $this->getUploadFSid()) {
                throw new \common_exception_NotAcceptable(
                    'The uploaded file url contains a wrong filesystem id!' .
                    '(Expected: `' . $this->getUploadFSid() . '` Actual: `' . $fakeFile->getFileSystemId() . '`)'
                );
            }

            $path .= $fakeFile->getBasename();
        }
        else {
            $path .= $serial;
        }

        $realFile = $this->getUploadDir()->getFile($path);
        if ($realFile->exists()) {
            return $realFile;
        }

        return null;
    }
1090166
private function getLocalCopy(File $file)
    {
        $tmpName = \tao_helpers_File::concat([\tao_helpers_File::createTempDir(), $file->getBasename()]);
        if (($resource = fopen($tmpName, 'wb')) !== false) {
            stream_copy_to_stream($file->readStream(), $resource);
            fclose($resource);
            $this->getServiceLocator()->get(EventManager::CONFIG_ID)->trigger(new UploadLocalCopyCreatedEvent($file,
                $tmpName));
            return $tmpName;
        }
        throw new \common_Exception('Impossible to make local file copy at ' . $tmpName);
    }