chore: import upstream snapshot with attribution
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:21:23 +08:00
commit b957a53def
5423 changed files with 863745 additions and 0 deletions
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft. All rights reserved.
using System.IO;
using System.Reflection;
internal static class RepoFiles
{
/// <summary>
/// Scan the local folders from the repo, looking for "prompt_template_samples" folder.
/// </summary>
/// <returns>The full path to prompt_template_samples</returns>
public static string SamplePluginsPath()
{
const string Folder = "prompt_template_samples";
static bool SearchPath(string pathToFind, out string result, int maxAttempts = 10)
{
var currDir = Path.GetFullPath(Assembly.GetExecutingAssembly().Location);
bool found;
do
{
result = Path.Join(currDir, pathToFind);
found = Directory.Exists(result);
currDir = Path.GetFullPath(Path.Combine(currDir, ".."));
} while (maxAttempts-- > 0 && !found);
return found;
}
if (!SearchPath(Folder, out var path))
{
throw new DirectoryNotFoundException("Plugins directory not found. The app needs the plugins from the repo to work.");
}
return path;
}
}