This is the code I can't get to work. If I remove the directory part with the space my shell script runs fine.
shell script simplified is : /usr/bin/find $1 -name *.txt
error with the space is binary operator expected
let bundle = NSBundle.mainBundle()
let path = bundle.pathForResource("doSimpleFind", ofType: "sh")
let findTask = NSTask()
let pipe = NSPipe()
findTask.standardOutput = pipe
// directory where to search from the script. testing the space in the name
let constArgsString:String = "/Users/aUser/Library/Application\\ Support"
//let constArgsString:String = "/Users/aUser/Library/"
findTask.launchPath = path!
findTask.arguments = [constArgsString]
findTask.launch()
findTask.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let outputText:String = NSString(data: data, encoding:NSUTF8StringEncoding)!
cmdTextResult.textStorage?.mutableString.setString(outputText)