You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Activity
vbreuss commentedon Oct 4, 2025
Currently there is no such built-in functionality. We only have a method to initialize the
MockFileSystemwith the embedded resources from an assembly (seeInitializeEmbeddedResourcesFromAssembly). 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.m-gallesio commentedon Oct 20, 2025
Understood, we will investigate further and consider contributing when we will get to the point of concretely needing this.
github-actions commentedon Feb 23, 2026
This is addressed in release v5.3.0.