xcodebuild error on file path

443 views Asked by At

I have a macOS application coded in Swift which does run a basic script (.command) file used to build projects.

The Swift application passes arguments to the script with the following method:

let path = Bundle.main.path(forResource: "script", ofType:"command")

var arguments: [String] = []
arguments.append("~/Projects/ios/ProjectFolderName/")
arguments.append("Project-Name")

self.process = Process()
self.process.launchPath = path
self.process.arguments = arguments

Script:

xcodebuild clean -workspace "${1}${2}.xcworkspace" -scheme "${3}" -configuration Release

Running my script using the application, it throws the following error (as the path exists):

xcodebuild: error: '~/Projects/ios/ProjectFolderName/Project-Name.xcworkspace' does not exist.

Remark: The file and the path exists. Using the terminal the command is running successfully

If I remove the arguments and hard code the path in the .command file, it does run successfully with the same application:

xcodebuild clean -workspace ~/Projects/ios/ProjectFolderName/Project-Name.xcworkspace -scheme "${3}" -configuration Release

I think there might be a problem converting the arguments. I did some echo tests to print the path of the arguments and everything seems to look pretty good.

0

There are 0 answers