This function creates a temporary directory structure based on the provided directory structure. It sets up directories and files as specified and provides a function to mimic `here::here()` behavior for accessing files within the mock directory. The temporary directory is automatically cleaned up after use.
Usage
create_mock_dir(dir_structure, .env = parent.frame())Value
A list containing:
- path
The path to the created mock directory.
- here
A function that mimics `here::here()` to access files within the mock directory.
Details
The function creates a temporary directory at a location determined by `tempdir()`, sets up the specified directory and file structure, and returns a list containing the path to the mock directory and a function to access files within it. The working directory is temporarily changed to the mock directory during the operation, and the original working directory is restored after cleanup.
