Portability of Windows executables that use resources

If I use the Bundle.module.url() API from my code on Windows, I noticed that it generates absolute paths to the resource bundle:

extension Foundation.Bundle {
    static var module: Bundle = {
        let mainPath = "C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin\\ABC_XYZ.resources"
        let buildPath = "C:\\Users\\pcbea\\Trees\\ABC\\.build\\x86_64-unknown-windows-msvc\\release\\ABC_XYX.resources"

        let preferredBundle = Bundle(path: mainPath)

        guard let bundle = preferredBundle != nil ? preferredBundle : Bundle(path: buildPath) else {
            fatalError("could not load resource bundle: from \(mainPath) or \(buildPath)")
        }

        return bundle
    }()
}

Wouldn't it be better to look relative to Bundle.main? I can imagine this approach is fine for debugging, but how would one ever deploy with this approach?

CC: @abertelrud @tomerd

IIRC, this is a generated file that is injected by SPM.

The generated code on macOS DOES look relative to the main bundle first.

Interesting, then that sounds like a bug in SPM (though part of this might be that TSC's path handling is fundamentally unportable due to lack of abstractions and we have tactical patches for trying to construct usable paths). The behaviour should be identical across the platforms.