Inuk Blog

If you've coded Vapor or any other SwiftPM project on mac, you may have found yourself in need of retrieving somethign from a relative path of the working directory. If you run the program from the command line, everything is okay, but Xcode has working directory a weird place. This is a short guide on how to change that.

First: Open the SwiftPM project as you usually do.

Second: Open the scheme editor, this can be done by option clicking the run button: Third: Navigate to "Working Directory" in Run -> Options. Check the check box and write the absolute path to your project, or wherever you want the working directory to be at! That's all really, remember this is a user setting, and should be set by everyone who uses Xcode in your team. It's not embarrassing to forget to set this on new projects, I unfortunately do that all the time 😅

Tagged with: