audit, advisories and doctors/setup work
This commit is contained in:
46
src/Tools/GoldenPairs/Services/GoldenPairsPaths.cs
Normal file
46
src/Tools/GoldenPairs/Services/GoldenPairsPaths.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace StellaOps.Tools.GoldenPairs.Services;
|
||||
|
||||
public static class GoldenPairsPaths
|
||||
{
|
||||
public const string DatasetRelativePath = "datasets/golden-pairs";
|
||||
public const string MetadataSchemaRelativePath = "docs/schemas/golden-pair-v1.schema.json";
|
||||
public const string IndexSchemaRelativePath = "docs/schemas/golden-pairs-index.schema.json";
|
||||
|
||||
public static string? TryResolveRepoRoot(string? repoRoot)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(repoRoot))
|
||||
{
|
||||
return Path.GetFullPath(repoRoot);
|
||||
}
|
||||
|
||||
var current = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
while (current is not null)
|
||||
{
|
||||
var solutionPath = Path.Combine(current.FullName, "src", "StellaOps.sln");
|
||||
if (File.Exists(solutionPath))
|
||||
{
|
||||
return current.FullName;
|
||||
}
|
||||
|
||||
current = current.Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string ResolveDatasetRoot(string repoRoot, string? overridePath = null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(overridePath))
|
||||
{
|
||||
return Path.GetFullPath(overridePath);
|
||||
}
|
||||
|
||||
return Path.GetFullPath(Path.Combine(repoRoot, DatasetRelativePath));
|
||||
}
|
||||
|
||||
public static string ResolveMetadataSchemaPath(string repoRoot)
|
||||
=> Path.GetFullPath(Path.Combine(repoRoot, MetadataSchemaRelativePath));
|
||||
|
||||
public static string ResolveIndexSchemaPath(string repoRoot)
|
||||
=> Path.GetFullPath(Path.Combine(repoRoot, IndexSchemaRelativePath));
|
||||
}
|
||||
Reference in New Issue
Block a user