Skip to content

Map actual directories in MockFileSystem #877

Description

@m-gallesio

Greetings.

Is there a way to make a part of a MockFileSystem point to an actual directory / file?
In our scenario we need to be able to read (not write) some actual files which are bundled with the application (mostly images and templates) while still mocking the rest.

A way I can think of is reading the target directory and mapping all of it manually when initialising the MockFileSystem, but I wonder if there is some built-in method / shortcut for this.

Activity

  1. vbreuss commented on Oct 4, 2025

    @vbreuss
    Member

    Currently there is no such built-in functionality. We only have a method to initialize the MockFileSystem with the embedded resources from an assembly (see InitializeEmbeddedResourcesFromAssembly). But I see your use case and would be open to a pull request that initializes the file system with the files and directories from a given directory.

  2. added theissue type on Oct 4, 2025
  3. m-gallesio commented on Oct 20, 2025

    @m-gallesio
    Author

    Understood, we will investigate further and consider contributing when we will get to the point of concretely needing this.

  4. self-assigned this
    on Feb 21, 2026
  5. github-actions commented on Feb 23, 2026

    @github-actions

    This is addressed in release v5.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions