Xcode file path error

243 views Asked by At

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")
1

There are 1 answers

0
PerfectlyRock On BEST ANSWER

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