Skip to content
Open
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
2 changes: 1 addition & 1 deletion Semantics.Paths/Implementations/AbsoluteDirectoryPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ktsu.Semantics.Paths;
/// <summary>
/// Represents an absolute directory path
/// </summary>
[IsPath, IsAbsolutePath, IsDirectoryPath]
[IsPath, IsAbsolutePath, IsAbsoluteDirectoryPath]
public sealed record AbsoluteDirectoryPath : SemanticDirectoryPath<AbsoluteDirectoryPath>, IAbsoluteDirectoryPath
{
// Cache for expensive parent directory computation
Expand Down
2 changes: 1 addition & 1 deletion Semantics.Paths/Implementations/DirectoryPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ktsu.Semantics.Paths;
/// <summary>
/// Represents a directory path (path to a directory)
/// </summary>
[IsPath, IsDirectoryPath]
[IsPath, IsAbsoluteDirectoryPath]
public sealed record DirectoryPath : SemanticDirectoryPath<DirectoryPath>, IDirectoryPath
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Semantics.Paths/SemanticDirectoryPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ktsu.Semantics.Paths;
/// <summary>
/// Base class for directory paths (paths that represent directories)
/// </summary>
[IsPath, IsDirectoryPath]
[IsPath]
public abstract record SemanticDirectoryPath<TDerived> : SemanticPath<TDerived>
where TDerived : SemanticDirectoryPath<TDerived>
{
Expand Down
4 changes: 2 additions & 2 deletions Semantics.Paths/SemanticRelativePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public static TRelativePath Make<TRelativePath, TFromPath, TToPath>(TFromPath fr
/// </summary>
/// <typeparam name="T">The type of semantic path to check.</typeparam>
/// <param name="path">The path instance to check.</param>
/// <returns><see langword="true"/> if the path type has the <see cref="IsDirectoryPathAttribute"/>; otherwise, <see langword="false"/>.</returns>
/// <returns><see langword="true"/> if the path type has the <see cref="IsAbsoluteDirectoryPathAttribute"/>; otherwise, <see langword="false"/>.</returns>
private static bool IsDirectoryPath<T>(T path) where T : SemanticPath<T>
{
// Check if it's a directory-specific type based on validation attributes
Type type = path.GetType();
return type.GetCustomAttributes(typeof(IsDirectoryPathAttribute), true).Length > 0;
return type.GetCustomAttributes(typeof(IsAbsoluteDirectoryPathAttribute), true).Length > 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ namespace ktsu.Semantics.Paths;
/// Validates that a path represents a directory (not an existing file)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class IsDirectoryPathAttribute : NativeSemanticStringValidationAttribute
public sealed class IsAbsoluteDirectoryPathAttribute : NativeSemanticStringValidationAttribute
{
/// <summary>
/// Creates the validation adapter for directory path validation.
/// </summary>
/// <returns>A validation adapter for directory paths</returns>
protected override ValidationAdapter CreateValidator() => new DirectoryPathValidator();
protected override ValidationAdapter CreateValidator() => new AbsoluteDirectoryPathValidator();

/// <summary>
/// validation adapter for directory paths.
/// </summary>
private sealed class DirectoryPathValidator : ValidationAdapter
private sealed class AbsoluteDirectoryPathValidator : ValidationAdapter
{
/// <summary>
/// Validates that a path represents a directory by ensuring it's not an existing file.
Expand Down
2 changes: 1 addition & 1 deletion Semantics.Test/PathValidationAttributeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public record TestRelativePath : SemanticString<TestRelativePath> { }
[IsValidFileName]
public record TestFileName : SemanticString<TestFileName> { }

[IsDirectoryPath]
[IsAbsoluteDirectoryPath]
public record TestDirectoryPath : SemanticString<TestDirectoryPath> { }

[IsFilePath]
Expand Down