protected function generateTyposcriptFiles()
 {
     if ($this->extension->hasPlugins() || $this->extension->hasBackendModules()) {
         // Generate TypoScript setup
         try {
             $this->mkdir_deep($this->extensionDirectory, 'Configuration/TypoScript');
             $typoscriptDirectory = $this->extensionDirectory . 'Configuration/TypoScript/';
             $fileContents = $this->generateTyposcriptSetup();
             $this->writeFile($typoscriptDirectory . 'setup.txt', $fileContents);
         } catch (Exception $e) {
             throw new Exception('Could not generate typoscript setup, error: ' . $e->getMessage());
         }
         // Generate TypoScript constants
         try {
             $typoscriptDirectory = $this->extensionDirectory . 'Configuration/TypoScript/';
             $fileContents = $this->generateTyposcriptConstants();
             $this->writeFile($typoscriptDirectory . 'constants.txt', $fileContents);
         } catch (Exception $e) {
             throw new Exception('Could not generate typoscript constants, error: ' . $e->getMessage());
         }
     }
     // Generate Static TypoScript
     try {
         if ($this->extension->getDomainObjectsThatNeedMappingStatements()) {
             $fileContents = $this->generateStaticTyposcript();
             $this->writeFile($this->extensionDirectory . 'ext_typoscript_setup.txt', $fileContents);
         }
     } catch (Exception $e) {
         throw new Exception('Could not generate static typoscript, error: ' . $e->getMessage());
     }
 }