зеркало из https://github.com/github/codeql.git
C#: Make `GetCSharpArgsLogs` robust against log directory not existing
This commit is contained in:
Родитель
c75e2d306d
Коммит
61973c399e
|
@ -492,8 +492,18 @@ namespace Semmle.Extraction.CSharp
|
|||
/// <summary>
|
||||
/// Gets a list of all `csharp.{hash}.txt` files currently written to the log directory.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> GetCSharpArgsLogs() =>
|
||||
Directory.EnumerateFiles(GetCSharpLogDirectory(), "csharp.*.txt");
|
||||
public static IEnumerable<string> GetCSharpArgsLogs()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Directory.EnumerateFiles(GetCSharpLogDirectory(), "csharp.*.txt");
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
// If the directory does not exist, there are no log files
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetCSharpLogDirectory()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче