Skip to content

Commit

Permalink
Normalize local DescriptionLocation to use / as directory separator
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtribick committed Jul 3, 2024
1 parent 77b80dd commit c87c7cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Kiota.Builder/Lock/LockManagementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ private static string GetRelativeDescriptionPath(string descriptionPath, string
{
if (IsDescriptionLocal(descriptionPath) &&
Path.GetDirectoryName(lockFilePath) is string lockFileDirectoryPath)
return Path.GetRelativePath(lockFileDirectoryPath, descriptionPath);
{
var relativePath = Path.GetRelativePath(lockFileDirectoryPath, descriptionPath);
if (Path.DirectorySeparatorChar != '/')
relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '/');
return relativePath;
}
return descriptionPath;
}
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public async Task UsesRelativePaths()
var outputDirectory = Path.Combine(tmpPath, "output");
Directory.CreateDirectory(outputDirectory);
await lockManagementService.WriteLockFileAsync(outputDirectory, lockFile);
Assert.Equal($"..{Path.DirectorySeparatorChar}information{Path.DirectorySeparatorChar}description.yml", lockFile.DescriptionLocation, StringComparer.OrdinalIgnoreCase);
Assert.Equal("../information/description.yml", lockFile.DescriptionLocation, StringComparer.OrdinalIgnoreCase);
}
[Fact]
public async Task DeletesALock()
Expand Down

0 comments on commit c87c7cc

Please sign in to comment.