Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .packageguard/cache.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Nuke.Components" Version="9.0.4" />
<PackageDownload Include="ReportGenerator" Version="[5.2.0]" />
<PackageDownload Include="GitVersion.Tool" Version="[6.0.2]" />
<PackageDownload Include="PackageGuard" Version="[1.4.1]" />
<PackageDownload Include="PackageGuard" Version="[1.6.0]" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Pathy.Specs")]
namespace Pathy
{
public static class ChainablePathExtensions
{
public static Pathy.ChainablePath[] GlobFiles(this Pathy.ChainablePath path, string globPattern) { }
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Pathy.Specs")]
namespace Pathy
{
public static class ChainablePathExtensions
{
public static Pathy.ChainablePath[] GlobFiles(this Pathy.ChainablePath path, string globPattern) { }
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Pathy.Specs")]
namespace Pathy
{
public static class ChainablePathExtensions
{
public static Pathy.ChainablePath[] GlobFiles(this Pathy.ChainablePath path, string globPattern) { }
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Pathy.Specs")]
namespace Pathy
{
public static class ChainablePathExtensions
{
public static Pathy.ChainablePath[] GlobFiles(this Pathy.ChainablePath path, string globPattern) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PackageReference>
<PackageReference Include="PublicApiGenerator" Version="11.4.6" />
<PackageReference Include="Verify.DiffPlex" Version="3.1.2" />
<PackageReference Include="Verify.Xunit" Version="30.5.0" />
<PackageReference Include="Verify.Xunit" Version="30.7.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Pathy.Globbing/Pathy.Globbing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImplicitUsings>disable</ImplicitUsings>
<NuSpecFile>.nuspec</NuSpecFile>
<NuspecProperties>version=$(Version)</NuspecProperties>
<DefineConstants>MYPACKAGE_COMPILE</DefineConstants>
<DefineConstants>PATHY_PUBLIC</DefineConstants>
<NoWarn>1591;1573</NoWarn>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
Expand Down
57 changes: 37 additions & 20 deletions Pathy.Globbing/PathyGlobbing.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// <autogenerated />

using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
Expand All @@ -10,32 +11,48 @@
#nullable disable

// ReSharper disable once CheckNamespace
namespace Pathy;

namespace Pathy
{
#if PATHY_PUBLIC
public static class ChainablePathExtensions
public static class ChainablePathExtensions
#else
internal static class ChainablePathExtensions
[global::Microsoft.CodeAnalysis.Embedded]
internal static class ChainablePathExtensions
#endif
{
/// <summary>
/// Matches files in the specified directory or subdirectories according to the provided glob pattern
/// and returns them as an array of <see cref="ChainablePath"/> objects.
/// </summary>
/// <remarks>
/// See also <seealso href="https://learn.microsoft.com/en-us/dotnet/core/extensions/file-globbing"/>
/// </remarks>
/// <param name="path">The base directory path to start the glob search from.</param>
/// <param name="globPattern">The glob pattern used to match file paths, e.g. **/*.md or dir/**/*</param>
public static ChainablePath[] GlobFiles(this ChainablePath path, string globPattern)
{
Matcher matcher = new(StringComparison.OrdinalIgnoreCase);
matcher.AddInclude(globPattern);

return matcher
.Execute(new DirectoryInfoWrapper(path.ToDirectoryInfo()))
.Files
.Select(file => ChainablePath.From(path / file.Path))
.ToArray();
}
}
}

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Matches files in the specified directory or subdirectories according to the provided glob pattern
/// and returns them as an array of <see cref="ChainablePath"/> objects.
/// A special attribute recognized by Roslyn, that marks a type as "embedded", meaning it won't ever be visible from other assemblies.
/// </summary>
/// <remarks>
/// See also <seealso href="https://learn.microsoft.com/en-us/dotnet/core/extensions/file-globbing"/>
/// </remarks>
/// <param name="path">The base directory path to start the glob search from.</param>
/// <param name="globPattern">The glob pattern used to match file paths, e.g. **/*.md or dir/**/*</param>
public static ChainablePath[] GlobFiles(this ChainablePath path, string globPattern)
[AttributeUsage(AttributeTargets.All)]
[ExcludeFromCodeCoverage]
internal sealed class EmbeddedAttribute : Attribute
{
Matcher matcher = new(StringComparison.OrdinalIgnoreCase);
matcher.AddInclude(globPattern);

return matcher
.Execute(new DirectoryInfoWrapper(path.ToDirectoryInfo()))
.Files
.Select(file => ChainablePath.From(path / file.Path))
.ToArray();
}
}
1 change: 0 additions & 1 deletion Pathy.Specs/ChainablePathSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using FluentAssertions;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion Pathy.Specs/Pathy.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="FluentAssertions" Version="8.5.0" />
<PackageReference Include="FluentAssertions" Version="8.6.0" />
<PackageReference Include="JetBrains.Annotations" Version="2025.2.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading
Loading