Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project json support #118

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Get the paths for omnisharp.json & project.json
JoshVarty committed Feb 1, 2016
commit dd09c3e1c396324dfcb066df936226b605ad03b4
28 changes: 6 additions & 22 deletions src/SourceBrowser.Site/Controllers/UploadController.cs
Original file line number Diff line number Diff line change
@@ -53,17 +53,15 @@ public ActionResult Submit(string githubUrl)
return View("Index");
}

// Generate the source browser files for this solution
var solutionPaths = GetSolutionPaths(repoRootPath);
if (solutionPaths.Length == 0)
{
ViewBag.Error = "No C# solution was found. Ensure that a valid .sln file exists within your repository.";
return View("Index");
}

var organizationPath = System.Web.Hosting.HostingEnvironment.MapPath("~/") + "SB_Files\\" + retriever.UserName;
var repoPath = Path.Combine(organizationPath, retriever.RepoName);


// Generate the source browser files for this solution
var solutionPaths = Directory.GetFiles(repoRootPath, "*.sln", SearchOption.AllDirectories);
var omnisharpPaths = Directory.GetFiles(repoRootPath, "omnisharp.json", SearchOption.AllDirectories);
var projectJsonPaths= Directory.GetFiles(repoRootPath, "project.json", SearchOption.AllDirectories);

// TODO: Use parallel for.
// TODO: Process all solutions.
// For now, we're assuming the shallowest and shortest .sln file is the one we're interested in
@@ -121,19 +119,5 @@ public ActionResult Submit(string githubUrl)
}
}
}

/// <summary>
/// Simply searches for the solution files and returns their paths.
/// </summary>
/// <param name="rootDirectory">
/// The root Directory.
/// </param>
/// <returns>
/// The solution paths.
/// </returns>
private string[] GetSolutionPaths(string rootDirectory)
{
return Directory.GetFiles(rootDirectory, "*.sln", SearchOption.AllDirectories);
}
}
}