[futurebasic] Re: [FB] CFStrings and Paths

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

From: Deep <Info@...>
Date: Tue, 28 Jun 2011 17:43:38 +0100
> From: Brian S <fblistserve@...>
> Reply-To: <futurebasic@...>
> Date: Tue, 28 Jun 2011 09:32:28 -0700
> To: <futurebasic@...>
> Subject: Re: [FB] CFStrings and Paths
> On Jun 28, 2011, at 3:53 AM, Deep wrote:
>> Trying to expand the traditional Unix notation "~/textFile.txt" into its
>> full path "/Users/username/textFile.txt" required for use in a CFURL.
> Robert P. addressed this in part on August 3, 2010 with his post titled
> "CFURLRefs From Unix filenames"
> Another item worth noting: expansion may NOT be necessary. Both FSFindFolder()
> and tools like FD_SpecialDirectoryCreateCFURL() are able to use _kUserDomain,
> _kCurrentUserFolderType which essentially is '~/'.
>> NSString *shortPath = @"~/textFile.txt";
>> NSString *absolutePath = [shortPath stringByExpandingTildeInPath];
>> NSString *originalpath = [absolutePath stringByAbbreviatingWithTildeInPath];
> Your Objective-C must obviously be bracketed by BeginCCode/EndC with
> appropriate declares for the wrapper C functions the FB code calls. There have
> been numerous examples of this recently, so I assume you can find them. While
> CFStrings are toll-free bridged to NSStrings, they must be coerced from one to
> the other at the time of use.
> Brian S

Hi Brian,

Thanks, yes I recall that thread, I started it. And as mentioned at that
time, the path is specified from the Command Line (Terminal) to a utility
built from FB. As you know, FB can build Command Line utilities as well as
normal GUI apps. Since users can enter a path via the command line, it is
likely to be in Unix shorthand. As mentioned in August, the FSFindFolder etc
are not useful in this situation. Robert's solution is part of my
"kludge-fix" but saw the Cocoa code and wondered if it could be used hence
the question.

Kind regards,