core-bundle/src/Resources/contao/library/Contao/ZipWriter.php
public function addFile($strFile, $strName=null)
	{
		if (!file_exists($this->strRootDir . '/' . $strFile))
		{
			throw new \Exception("File $strFile does not exist");
		}

		// Remove leading slashes (see #4502)
		if (strncmp($strName, '/', 1) === 0)
		{
			$strName = substr($strName, 1);
		}

		$this->addString(file_get_contents($this->strRootDir . '/' . $strFile), $strName ?: $strFile, filemtime($this->strRootDir . '/' . $strFile));
	}
public function addFile($strFile, $strName=null)
	{
		if (!file_exists($this->strRootDir . '/' . $strFile))
		{
			throw new \Exception("File $strFile does not exist");
		}

		// Remove leading slashes (see #4502)
		if (strncmp($strName, '/', 1) === 0)
		{
			$strName = substr($strName, 1);
		}

		$this->addString(file_get_contents($this->strRootDir . '/' . $strFile), $strName ?: $strFile, filemtime($this->strRootDir . '/' . $strFile));
	}
Add a file to the archive

@param string $strFile The file path
@param string $strName An optional file name

@throws \Exception If $strFile does not exist