Skip to content

Commit cfbaca8

Browse files
Merge pull request #780 from jimmylewis/normalize
Change file normalization to not lowercase all file names
2 parents 0e96d3d + 3edf1e9 commit cfbaca8

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/LibraryManager.Contracts/FileHelpers.cs

+1-12
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public static bool IsUnderRootDirectory(string filePath, string rootDirectory)
385385
/// Normalizes the path string so it can be easily compared.
386386
/// </summary>
387387
/// <remarks>
388-
/// Result will be lowercase and have any trailing slashes removed.
388+
/// Result will be resolved to an absolute path and have any trailing slashes removed.
389389
/// </remarks>
390390
public static string NormalizePath(string path)
391391
{
@@ -400,17 +400,6 @@ public static string NormalizePath(string path)
400400
return path;
401401
}
402402

403-
// net451 does not have the OSPlatform apis to determine if the OS is windows or not.
404-
// This also does not handle the fact that MacOS can be configured to be either sensitive or insenstive
405-
// to the casing.
406-
if (Path.DirectorySeparatorChar == '\\')
407-
{
408-
#pragma warning disable CA1308 // Normalize strings to uppercase
409-
// Reason: we prefer lowercase names for file paths
410-
path = path.ToLowerInvariant();
411-
#pragma warning restore CA1308 // Normalize strings to uppercase
412-
}
413-
414403
return Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
415404
}
416405

src/LibraryManager/Providers/BaseProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private OperationResult<LibraryInstallationGoalState> GenerateGoalState(ILibrary
259259
mappings.Add(new FileMapping { Destination = desiredState.DestinationPath });
260260
}
261261

262-
Dictionary<string, string> installFiles = new();
262+
Dictionary<string, string> installFiles = new(StringComparer.OrdinalIgnoreCase);
263263

264264
foreach (FileMapping fileMapping in mappings)
265265
{

0 commit comments

Comments
 (0)