I wrote a Swift command line tool using SPM's executable type. Bundle.main.bundlePath
always returns the built binary file's directory path during development stage (debug build).
Then, I release built the binary to foo/my-binary
, and added a symbolic link at /usr/local/bin/my-binary
. Now if I call my binary from an arbitrary location (say ~
), Bundle.main.bundlePath
actually gives me the path of /usr/local/bin/my-binary
.
Is this expected? Is it possible to get foo/my-binary
when I call its symbolic link?