I am having trouble reading a file within a command line tool project in Xcode 11.6.
Steps:
Create a new command line tool project using the template in the mac os section.
In main.swift:
import Foundation let fileURL = URL( fileURLWithPath: "/Users/ausom4/Desktop/myTest.txt" ) var rawDataString: String var errorString: String? do { rawDataString = try String( contentsOf: fileURL, encoding: .utf8 ) print(rawDataString) } catch let error as NSError { errorString = error.description rawDataString = "" print(rawDataString) } This will build successfully in Xcode however will always print a null string in the console.
However if I go to the location of my product in terminal and run the build I get the contents of the file.
I do not have sandboxing enabled. Sandboxing is also not enabled by default in this xcode template. I have also given xcode full disk access.
I can run this code in a playground.
What could be the issue here?

print(error)...