private static string GetFilePath()

in src/Azure.Deployments.Extensibility.Extensions.Kubernetes/Api/ApiCatalog/K8sApiCatalog.cs [73:89]


        private static string GetFilePath()
        {
            var repoRootDirectory = new DirectoryInfo(Environment.CurrentDirectory);

            while (repoRootDirectory.Parent is { } parentDirectory)
            {
                // search upwards for the .git directory. This should only exist at the repository root.
                if (Directory.Exists(Path.Join(repoRootDirectory.FullName, ".git")))
                {
                    return Path.Combine(repoRootDirectory.FullName, "src", $"{Assembly.GetExecutingAssembly().GetName().Name}", "Api", "ApiCatalog", FileName);
                }

                repoRootDirectory = parentDirectory;
            }

            throw new InvalidOperationException($"Unable to determine the repo root path from directory {Environment.CurrentDirectory}");
        }