Shafraz Buhary
Shafraz Buhary

Reputation: 663

Xcode file path error

I am developing backend with Perfect + Swift3, I want to load a text file with configuration. When I run the project in Xcode8 id does not detect the text file. However when I build the app for linux it works fine. After debug I found problem is Xcode doesn't copy the text file to its build directory. Please let me know how I can make Xcode to copy it to build directory and make accessible to excitable.

let lines = try! String(contentsOfFile: ").components(separatedBy: "\n")

Upvotes: 1

Views: 312

Answers (1)

PerfectlyRock
PerfectlyRock

Reputation: 413

please go to Xcode - project (My Mac) - Edit Scheme - Run - Working Directory - Use custom working directory - $(PROJECT_DIR), as the screen shot:

enter image description here

Upvotes: 2

Related Questions