I'm trying to make a macro that has the following structure:
@SampleDataProviding(decoder: JSONDecoder(), bundlePath: Bundle.module.bundlePath, fileExtension: "json")
The primary issue that I am having is that I need to be able to scan a subdirectory of the bundlePath for files that match a certain criteria. However, when I try to access the Bundle.module.bundlePath it literally spits back at me "Bundle.module.bundlePath" which obviously doesn't get me anywhere. I've looked all over for a way to convert what I enter at the macro call site to an actual path that I can put in code that isn't generated. (This macro goes through a specific subdirectory looking for sample data files which it then generates a variable expression for each of them so that it is easy to access this sample data (for UI work or testing).) Each time I try this it fails stating that the folder doesn't exist because it's looking for "Bundle.module.bundlePath/[subdirectory]" when I want it to look for the subdirectory in the bundle path, not "Bundle.module.bundlePath". I've been able to get this to work in testing by wrapping the call in an interpolation from a string but this does not work in the real world because the compiler complains that the interpolation cannot be modified (it is also more clunky, I would prefer to avoid having to wrap the entire thing in an interpolation).