-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic updating of CodexPlugin openapi.yaml.
- Loading branch information
1 parent
9ca4bf8
commit 960b0c3
Showing
7 changed files
with
76 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace Utils | ||
{ | ||
public static class PluginPathUtils | ||
{ | ||
private const string ProjectPluginsFolderName = "ProjectPlugins"; | ||
private static string projectPluginsDir = string.Empty; | ||
|
||
public static string ProjectPluginsDir | ||
{ | ||
get | ||
{ | ||
if (string.IsNullOrEmpty(projectPluginsDir)) projectPluginsDir = FindProjectPluginsDir(); | ||
return projectPluginsDir; | ||
} | ||
} | ||
|
||
private static string FindProjectPluginsDir() | ||
{ | ||
var current = Directory.GetCurrentDirectory(); | ||
while (true) | ||
{ | ||
var localFolders = Directory.GetDirectories(current); | ||
var projectPluginsFolders = localFolders.Where(l => l.EndsWith(ProjectPluginsFolderName)).ToArray(); | ||
if (projectPluginsFolders.Length == 1) | ||
{ | ||
return projectPluginsFolders.Single(); | ||
} | ||
|
||
var parent = Directory.GetParent(current); | ||
if (parent == null) | ||
{ | ||
var msg = $"Unable to locate '{ProjectPluginsFolderName}' folder. Travelled up from: '{Directory.GetCurrentDirectory()}'"; | ||
Console.WriteLine(msg); | ||
throw new Exception(msg); | ||
} | ||
|
||
current = parent.FullName; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters