using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Semmle.Util
{
public static class CommandLineExtensions
{
///
/// Archives the first "@" argument in a list of command line arguments.
/// Subsequent "@" arguments are ignored.
///
/// The raw command line arguments.
/// The full filename to write to.
/// True iff the file was written.
public static bool ArchiveCommandLine(this IEnumerable commandLineArguments, string filename)
{
foreach (var arg in commandLineArguments.Where(arg => arg[0] == '@').Select(arg => arg.Substring(1)))
{
File.Copy(arg, filename, true);
return true;
}
return false;
}
}
}