Skip to content

Commit

Permalink
Don't replace up front.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Mar 27, 2024
1 parent a13b308 commit 92d5eec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/IKVM.Maven.Sdk.Tasks/NuGetApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal IEnumerable<string> GetProjectObjectModelFiles(LockFile lockFile, strin
var pomPathsByTfm = lib.Files
.Where(i => i.StartsWith("maven/") && i.EndsWith($"/{library.Name}.pom"))
.Select(i => new { Segments = i.Split('/'), File = i }).Where(i => i.Segments.Length == 3)
.Select(i => new { Folder = i.Segments[1], Path = i.File.Replace('/', Path.DirectorySeparatorChar) })
.Select(i => new { Folder = i.Segments[1], Path = i.File })
.GroupBy(i => i.Folder)
.Select(i => new FrameworkSpecificGroup(NuGetFramework.ParseFolder(i.Key), i.Select(j => j.Path).ToList()))
.ToList();
Expand All @@ -92,6 +92,7 @@ internal IEnumerable<string> GetProjectObjectModelFiles(LockFile lockFile, strin
if (compatibleGroup == null)
continue;

// start root path at lock file, if no other exists
var root = ".";
if (lockFile.Path != null)
root = Path.GetDirectoryName(lockFile.Path);
Expand All @@ -105,6 +106,11 @@ internal IEnumerable<string> GetProjectObjectModelFiles(LockFile lockFile, strin
}
}

/// <summary>
/// Replace OS-specific separators with current OS separators.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
string FixPath(string value)
{
return value.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
Expand Down

0 comments on commit 92d5eec

Please sign in to comment.