I made a Swift 5 macOS app, which loads some data from the folder where the .app file is located. Here is my code:
rutaApp = Bundle.main.bundlePath.replacingOccurrences(of: "/RetroMac.app", with: "")
it works ok in my computer. Then use Product -> Archive -> Copy App, and send my App.app file to an user who executes it.
For my surprise it crashes, saying that the path to the App.app file is "/private/var/folders/8g/7xj3ck2954ddhtrvzr89wklw0000gn/T/AppTranslocation/20D2ED2A-D864-4EFD-8310-7BD3476B4F44/d/" instead of "Documents/folderwheremyappis/"
Why does it happen and how to solve it?