I'm working on various command line tools for macOS and Linux, written in Swift. The auto-generated resource_bundle_accessor.swift does only look in two places, the directory where the binary is located and the actual build directory.
At least for Linux, this is a bit of a problem for packaging, since we don't want to pollute the $bindir. The usual way is to look for resources in $datadir, e.g., /usr/share/<projectName>/.
I believe that the behavior is based on extensive review of SE-0271: Package Manager Resources. The decision notes state the following:
the proposal states that resource bundles will be located next to the built executable only on Linux, but that doesn't quite match up with how software is packaged up there. In addition, resources will also automatically be found in all locations specified in https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/FHS%20Bundles.md and there will be a commandline flag to add search paths to custom locations.
Excellent, many thanks for the pointer. Now I wonder is that the description of the plan or the status quo?
And does it play well with cross-compilation where resource_bundle_accessor.swift is generated and compiled on macOS, but will actually run on a Linux machine?