Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions ProjectReferencesRuler/PathNormalizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace ProjectReferencesRuler
{
internal static class PathNormalizer
{
/// <summary>
/// Replaces \ with / so the same code works on both Windows and Linux.
/// </summary>
public static string CleanPath(string path)
{
return path.Replace("\\", "/");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Xml.Linq;
using ProjectReferencesRuler.Rules.Project;
using ProjectReferencesRuler.Rules.References;
using static ProjectReferencesRuler.PathNormalizer;

namespace ProjectReferencesRuler.ProjectParsing
{
Expand Down Expand Up @@ -74,14 +75,6 @@ public Project GetProjectProperties(string csprojPath)
targetFrameworks: GetTargetFrameworks(doc).ToList());
}

/// <summary>
/// Replaces \ with / in order for this same code to work on both Windows and Linux.
/// </summary>
private static string CleanPath(string path)
{
return path.Replace("\\", "/");
}

private IEnumerable<string> GetTargetFrameworks(XDocument doc)
{
foreach (var propertyGroup in doc.Root.ElementsIgnoreNamespace(PropertyGroup))
Expand Down
9 changes: 1 addition & 8 deletions ProjectReferencesRuler/SolutionParsing/SolutionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Xml;
using static ProjectReferencesRuler.PathNormalizer;

namespace ProjectReferencesRuler.SolutionParsing
{
Expand Down Expand Up @@ -88,13 +89,5 @@ private string ParseProjectPath(string line)
// removes the parenthesis
return pathInParenthesis.Trim().Substring(1, pathInParenthesis.Length - 3);
}

/// <summary>
/// Replaces \ with / in order for this same code to work on both Windows and Linux.
/// </summary>
private static string CleanPath(string path)
{
return path.Replace("\\", "/");
}
}
}
Loading