Added support for reading file lists from stdin

This commit is contained in:
Joshua Beck 2011-09-26 04:04:16 -05:00
parent ef6a14dbaf
commit 240ba0118a
1 changed files with 12 additions and 2 deletions

View File

@ -45,11 +45,21 @@ static void AddFilesToList(const std::string& FileList, std::vector<std::string>
// xml is a bonus then, since we can easily extend it
// we need a good parser then -> suggestion : TinyXml
// drawback : creates a dependency
std::ifstream Files(FileList.c_str());
std::istream *Files;
std::ifstream Infile;
if (FileList.compare("-") == 0) // read from stdin
{
Files = &std::cin;
}
else
{
Infile.open(FileList.c_str());
Files = &Infile;
}
if (Files)
{
std::string FileName;
while (std::getline(Files, FileName)) // next line
while (std::getline(*Files, FileName)) // next line
{
if (!FileName.empty())
{