Example #1
0
 /**
  * Reads file names from a file and adds them to the files array.
  *
  * @param Project $p
  *
  * @throws BuildException
  */
 private function readListFile(Project $p)
 {
     $listReader = null;
     try {
         // Get a FileReader
         $listReader = new BufferedReader(new FileReader($this->listfile));
         $line = $listReader->readLine();
         while ($line !== null) {
             if (!empty($line)) {
                 $line = $p->replaceProperties($line);
                 $this->filenames[] = trim($line);
             }
             $line = $listReader->readLine();
         }
     } catch (Exception $e) {
         if ($listReader) {
             $listReader->close();
         }
         throw new BuildException("An error occurred while reading from list file " . $this->listfile->__toString() . ": " . $e->getMessage());
     }
     $listReader->close();
 }
Example #2
0
 /**
  *  Reads path matching patterns from a file and adds them to the
  *  includes or excludes list
  */
 private function readPatterns(PhingFile $patternfile, &$patternlist, Project $p)
 {
     $patternReader = null;
     try {
         // Get a FileReader
         $patternReader = new BufferedReader(new FileReader($patternfile));
         // Create one NameEntry in the appropriate pattern list for each
         // line in the file.
         $line = $patternReader->readLine();
         while ($line !== null) {
             if (!empty($line)) {
                 $line = $p->replaceProperties($line);
                 $this->addPatternToList($patternlist)->setName($line);
             }
             $line = $patternReader->readLine();
         }
     } catch (IOException $ioe) {
         $msg = "An error occured while reading from pattern file: " . $patternfile->__toString();
         if ($patternReader) {
             $patternReader->close();
         }
         throw new BuildException($msg, $ioe);
     }
     $patternReader->close();
 }