# Package resources from a directory named with an extension

**URL:** <https://forums.swift.org/t/package-resources-from-a-directory-named-with-an-extension/43423>\
**Category:** Using Swift\
**Tags:** resources, packagemanager\
**Created:** [December 29, 2020, 4:35pm UTC](https://forums.swift.org/t/package-resources-from-a-directory-named-with-an-extension/43423 "2020-12-29T16:35:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr-fixit](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mr-fixit/32/8721_2.png) [@mr-fixit](https://forums.swift.org/u/mr-fixit)\
**Post date:** [December 29, 2020, 4:35pm UTC](https://forums.swift.org/t/package-resources-from-a-directory-named-with-an-extension/43423/1 "2020-12-29T16:35:32Z")

</div>

We're adding SPM support to a pre-existing project. We have PNG resources inside a foo.bundle.

But it appears that because the parent directory has an extension (e.g. ".bundle"), SPM doesn't copy (or "process") the PNG.

Is that expected?

The following test illustrates the problem. (derived from [swift-package-manager/BuildPlanTests.swift at main · apple/swift-package-manager · GitHub](https://github.com/apple/swift-package-manager/blob/main/Tests/BuildTests/BuildPlanTests.swift#L2358))

```swift
    func testSwiftBundleAccessor() throws {
        // This has a Swift and ObjC target in the same package.
        let fs = InMemoryFileSystem(emptyFiles:
            "/PkgA/Sources/Foo/Foo.swift",
            "/PkgA/Sources/Foo/foo.txt",
            "/PkgA/Sources/Foo/sub.sub/subfoo.txt"
        )

        let diagnostics = DiagnosticsEngine()

        let graph = try loadPackageGraph(
            fs: fs,
            diagnostics: diagnostics,
            manifests: [
                Manifest.createManifest(
                    name: "PkgA",
                    path: "/PkgA",
                    url: "/PkgA",
                    v: .v5_3,
                    packageKind: .root,
                    targets: [
                        TargetDescription(
                            name: "Foo",
                            exclude: ["sub.sub"],
                            resources: [
                                .init(rule: .copy, path: "foo.txt"),
                                .init(rule: .process, path: "sub.sub/subfoo.txt"),
                            ]
                        ),
                    ]
                )
            ]
        )
        
        XCTAssertNoDiagnostics(diagnostics)

        let plan = try BuildPlan(
            buildParameters: mockBuildParameters(),
            graph: graph,
            diagnostics: diagnostics,
            fileSystem: fs
        )

        try testWithTemporaryDirectory { path in
            let yaml = path.appending(component: "debug.yaml")
            let llbuild = LLBuildManifestBuilder(plan)
            try llbuild.generateManifest(at: yaml)
            let contents = try localFileSystem.readFileContents(yaml).description
            XCTAssertMatch(contents, .contains("subfoo.txt"))
        }

    }

```
