Skip to content

Commit

Permalink
fix: fix faulty project-path when parsing under linux
Browse files Browse the repository at this point in the history
the directories in the solution are usually separated using backwards-slashes ('\')
under linux, the path of the solution-file (using forward-slashes ('/')) is combined
with the path that is used in the solution itself. Resulting in something like
'/some/path/to\project.csproj', resulting in a faulty path, which leads to other problems
  • Loading branch information
wgnf committed Jun 6, 2023
1 parent 5dfd334 commit 926ffbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SlnParser/Helper/ProjectDefinitionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public bool TryParseProjectDefinition(
if (solutionDirectory == null)
throw new UnexpectedSolutionStructureException("Solution-Directory could not be determined");

// NOTE: the path to the project-file is usually separated using '\' - this does not work under linux
projectPath = projectPath.Replace('/', Path.DirectorySeparatorChar);
projectPath = projectPath.Replace('\\', Path.DirectorySeparatorChar);

var projectFileCombinedWithSolution = Path.Combine(solutionDirectory, projectPath);
var projectFile = new FileInfo(projectFileCombinedWithSolution);

Expand Down

0 comments on commit 926ffbf

Please sign in to comment.