Skip to content

FileBase, DirectoryBase, PathBase, etc. should expose an IFileSystem property #351

@herebebeasties

Description

@herebebeasties

We have an internal extensions library for IFileSystem that adds various nice extension methods like Unzip(...) and DeleteDirectoryContents(...).

Because these need to use operations on a mixture of FileBase, DirectoryBase and PathBase, these currently need to be extension methods on IFileSystem which isn't ideal:

  • It's much less discoverable, particularly for things that really ought to live alongside a closely-related API like DirectoryBase.Delete.
  • It causes API breaks if you add functionality to an extension method on FileBase and suddenly discover you need to move it to an IFileSystem one instead.

It would be extremely useful to expose the underlying IFileSystem on all these base classes as a property, which would fix this.

It would be a pretty trivial change, obviously, although as with any API addition would break anyone who has a custom implementations of FileBase, etc. as obviously they'd need to add it in (pretty trivial to fix, though).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: in workIssues that are currently worked ontype: enhancementIssues that propose new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions