core-bundle/src/Resources/contao/library/Contao/File.php
protected function createIfNotExists()
	{
		// The file exists
		if (file_exists($this->strRootDir . '/' . $this->strFile))
		{
			return;
		}

		// Handle open_basedir restrictions
		if (($strFolder = \dirname($this->strFile)) == '.')
		{
			$strFolder = '';
		}

		// Create the folder
		if (!is_dir($this->strRootDir . '/' . $strFolder))
		{
			new Folder($strFolder);
		}

		// Open the file
		if (!$this->resFile = $this->Files->fopen($this->strFile, 'wb'))
		{
			throw new \Exception(sprintf('Cannot create file "%s"', $this->strFile));
		}
	}
protected function createIfNotExists()
	{
		// The file exists
		if (file_exists($this->strRootDir . '/' . $this->strFile))
		{
			return;
		}

		// Handle open_basedir restrictions
		if (($strFolder = \dirname($this->strFile)) == '.')
		{
			$strFolder = '';
		}

		// Create the folder
		if (!is_dir($this->strRootDir . '/' . $strFolder))
		{
			new Folder($strFolder);
		}

		// Open the file
		if (!$this->resFile = $this->Files->fopen($this->strFile, 'wb'))
		{
			throw new \Exception(sprintf('Cannot create file "%s"', $this->strFile));
		}
	}
protected function createIfNotExists ( ) { // The file exists if ( file_exists ( $ this -> strRootDir . '/' . $ this -> strFile ) ) { return ; } // Handle open_basedir restrictions if ( ( $ strFolder = \ dirname ( $ this -> strFile ) ) == '.' ) { $ strFolder = '' ; } // Create the folder if ( ! is_dir ( $ this -> strRootDir . '/' . $ strFolder ) ) { new Folder ( $ strFolder ) ; } // Open the file if ( ! $ this -> resFile = $ this -> Files -> fopen ( $ this -> strFile , 'wb' ) ) { throw new \ Exception ( sprintf ( 'Cannot create file "%s"' , $ this -> strFile ) ) ; } }
Create the file if it does not yet exist

@throws \Exception If the file cannot be written
Create the file if it does not yet exist