/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Tools/RunTests/FileUtil.cs
70 строк
2 KB
Copilot
Remove superfluous `src/Tools/Source` directory level (#83484)
30 апр 2026, 06:54
Не верифицирован
30 апр 2026, 06:54
2933275
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.IO; namespace RunTests { internal static class FileUtil { /// <summary> /// Ensure a directory with the given name is present. Will be created if necessary. True /// is returned when it is created. /// </summary> internal static bool EnsureDirectory(string directory) { if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); return true; } return false; } /// <summary> /// Delete file if it exists and swallow any potential exceptions. Returns true if the /// file is actually deleted. /// </summary> internal static bool DeleteFile(string filePath) { try { if (File.Exists(filePath)) { File.Delete(filePath); return true; } } catch { // Ignore } return false; } /// <summary> /// Delete directory if it exists and swallow any potential exceptions. Returns true if the /// directory is actually deleted. /// </summary> internal static bool DeleteDirectory(string directory) { try { if (Directory.Exists(directory)) { Directory.Delete(directory, recursive: true); return true; } } catch { // Ignore } return false; } } }