diff --git a/src/Common/Core/IO/CodeSolutionHelper.cs b/src/Common/Core/IO/CodeSolutionHelper.cs new file mode 100644 index 0000000..1707fb5 --- /dev/null +++ b/src/Common/Core/IO/CodeSolutionHelper.cs @@ -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; + } +}