[futurebasic] Correct escape and correct call to create a posix style path

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2010 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Sat, 19 Jun 2010 20:53:00 -0700
In a CFStringRef named ‘path’ there is a path to a script in my bundle that is:
/Users/brianstevens/Desktop/NewStuff/bug testing/build_temp/XcodeProject/build/Debug/unixReplaceOsascript.app/Contents/Resources/myMailAscrpt.scpt

( which was retrieved via: fn CFBundleCopyResourceURL( fn CFBundleGetMainBundle(), @"myMailAscrpt.scpt", 0, 0 )  :  fn CFURLCopyFileSystemPath ( url, _kCFURLPOSIXPathStyle )  which I hope is mostly moot for these questions )

Notice the space between ‘bug’ and ‘testing’ in the full path. I’m trying to feed this path to the osascript command and the console message is predictably:

6/19/10 6:29:35 PM	[0x0-0x5d05d].unixReplaceOsascript[1456]	osascript: /Users/brianstevens/Desktop/NewStuff/bug: No such file or directory

The space appears to be the issue. Two questions if I may:

(1) Which type of escape ( either percent ‘%’ or backslash ‘\’ ) or fix is appropriate for this scenario?

(2) Assuming backslash ( because there is CFURLCreateStringByAddingPercentEscapes() and %20 for the space also fails in the path ), is someone aware of a CF or framework call to replace the space with something appropriate?

I’m probably overlooking something simple but don’t see it yet.

btw: I’m avoiding pascal string solutions such as the fn EscapeBadPathCharacters( used by FBtoC and posted to the list I believe )

TIA… 

Brian S