Skip to content

Commit db0d7b8

Browse files
authored
housekeeping: Add exact version matching only for uap assemblies (#189)
* housekeeping: Make icsharpcode non-package * housekeeping: Add exact version matching only for uap assemblies
1 parent e453f5d commit db0d7b8

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/Pharmacist.Core/Utilities/AssemblyHelpers.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,8 @@ internal static class AssemblyHelpers
7777

7878
private static string FindClosestVersionDirectory(string basePath, Version version)
7979
{
80-
string? path = null;
81-
foreach (var (versionFolder, name) in new DirectoryInfo(basePath)
82-
.EnumerateDirectories()
83-
.Select(d => ConvertToVersion(d.Name))
84-
.Where(v => v.Version != null)
85-
.OrderBy(v => v.Version))
86-
{
87-
if (path == null || versionFolder >= version)
88-
{
89-
path = name;
90-
}
91-
}
80+
var directory = new DirectoryInfo(basePath);
81+
string? path = directory.EnumerateDirectories().Select(d => ConvertToVersion(d.Name)).Where(x => x.Version is not null && x.Version == version).Select(x => x.Name).FirstOrDefault();
9282

9383
return path ?? version.ToString();
9484
}

0 commit comments

Comments
 (0)