Preserve file hierarchy in the Resources directory

Hey Noam!

I’ve tried adding an extra level of nesting for some resources in this fixture and the hierarchy was preserved (see the ExtraLevel):

Maybe you could explore that fixture and see how your project differs? If you can’t figure it out, maybe you could create your own fixture that we could take a look at?

thanks for the quick response!
indeed, the hierarchy is preserved in the IDE.
i moved the text file into a subdirecory, like it the image, and it shows in the correct place in the IDE

but somehow, when running the app tests, the file ends up in a flattened path.
at least, when i print the bundle content with
po try? FileManager.default.subpathsOfDirectory(atPath: Bundle.main.bundlePath)
in the test, i get this:

    - 52 : "StaticFramework2Resources.bundle/_CodeSignature/CodeRequirements"
    - 53 : "StaticFramework2Resources.bundle/StaticFramework2Resources-tuist.png"
    - 54 : "StaticFramework2Resources.bundle/Info.plist"
    - 55 : "StaticFramework2Resources.bundle/StaticFramework2Resources-text.txt"

Is that still happening if the framework product is changed to a .framework (ie a dynamic framework)?

yes, i changed StaticFramework2 to be a .framework and got the same result from the debugger.

    - 107 : "Frameworks/StaticFramework2.framework/StaticFramework2Resources.bundle/_CodeSignature/CodeRequirements"
    - 108 : "Frameworks/StaticFramework2.framework/StaticFramework2Resources.bundle/StaticFramework2Resources-tuist.png"
    - 109 : "Frameworks/StaticFramework2.framework/StaticFramework2Resources.bundle/Info.plist"
    - 110 : "Frameworks/StaticFramework2.framework/StaticFramework2Resources.bundle/StaticFramework2Resources-text.txt"

Are you sure the flattening is specific to Tuist then? I wonder if this is default xcodebuild behavior.

well, looking into it - no. it’s not the xCode default.
it’s needs manual setting in xcode,
which of coarse, could be done in tuist manually with resources[ .folderReference()

thanks!

1 Like