Skip to content

Commit

Permalink
定义代码辅助类
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Sep 10, 2024
1 parent 83e414a commit f4f12cc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Common/Core/IO/CodeSolutionHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Lindexi.Src.Core.IO;

public static class CodeSolutionHelper
{
public static string? GetCodeSolutionPath(string? currentPath = null)
{
currentPath ??= Directory.GetCurrentDirectory();

while (currentPath != null)
{
var files = Directory.EnumerateFiles(currentPath, "*.sln");
if (files.Any())
{
return currentPath;
}

currentPath = Path.GetDirectoryName(currentPath);
}

return null;
}
}

0 comments on commit f4f12cc

Please sign in to comment.