mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
feature: ignore case when finding visual studio solution file
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
921b8599df
commit
310c786693
1 changed files with 11 additions and 8 deletions
|
@ -353,23 +353,26 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
private string GenerateCommandlineArgsForVisualStudio(string repo)
|
private string GenerateCommandlineArgsForVisualStudio(string repo)
|
||||||
{
|
{
|
||||||
var sln = FindVSSolutionFile(repo, 4);
|
var sln = FindVSSolutionFile(new DirectoryInfo(repo), 4);
|
||||||
return string.IsNullOrEmpty(sln) ? $"\"{repo}\"" : $"\"{sln}\"";
|
return string.IsNullOrEmpty(sln) ? $"\"{repo}\"" : $"\"{sln}\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FindVSSolutionFile(string path, int leftDepth)
|
private string FindVSSolutionFile(DirectoryInfo dir, int leftDepth)
|
||||||
{
|
{
|
||||||
var found = Directory.GetFiles(path, "*.sln", SearchOption.TopDirectoryOnly);
|
var files = dir.GetFiles();
|
||||||
if (found != null && found.Length > 0)
|
foreach (var f in files)
|
||||||
return Path.GetFullPath(found[0]);
|
{
|
||||||
|
if (f.Name.EndsWith(".sln", StringComparison.OrdinalIgnoreCase))
|
||||||
|
return f.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
if (leftDepth <= 0)
|
if (leftDepth <= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var subfolders = Directory.GetDirectories(path);
|
var subDirs = dir.GetDirectories();
|
||||||
foreach (var subfolder in subfolders)
|
foreach (var subDir in subDirs)
|
||||||
{
|
{
|
||||||
var first = FindVSSolutionFile(subfolder, leftDepth - 1);
|
var first = FindVSSolutionFile(subDir, leftDepth - 1);
|
||||||
if (!string.IsNullOrEmpty(first))
|
if (!string.IsNullOrEmpty(first))
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue