Re: CFURLRef -> NSFileManager path
Re: CFURLRef -> NSFileManager path
- Subject: Re: CFURLRef -> NSFileManager path
- From: Jonathan Stocks <email@hidden>
- Date: Thu, 13 Jun 2002 09:28:36 -0700
Hi Patrick,
I think this should be pretty simple. You should be able to use the
NSString method:
+ (id)stringWithCString:(const char *)cString
or
+ (id)stringWithCString:(const char *)cString length:(unsigned)length
You can find information on this at:
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
Classes/NSString.html
I don't think you should run into any problems in converting from a
UInt8 to a char, but you might want to be aware of this.
This should convert your output from FSRefMakePath to an NSString.
For a quick example:
UInt8 array[100];
FSRef ref;
NSString *str;
// Get your FSRef ref by whatever means you get it :)
err = FSRefMakePath( &ref, array, 100 );
// test must be null terminated for stringWithCString
tempStr = [NSString stringWithCString: test];
NSLog( tempStr );
I hope this helps (or at least gets you started).
Thanks,
Jon
On Wednesday, June 12, 2002, at 09:14 PM, Patrick Tescher wrote:
>
This may seem easy but how do I make a NSString from from the output of
>
FSRefMakePath?
>
>
On Tuesday, June 11, 2002, at 05:56 PM, Jonathan Stocks wrote:
>
>
> Hi Patrick,
>
>
>
> Have you taken a look at FSRefMakePath(...). This might do what you
>
> want.
>
> You can find information about it at:
>
>
>
> http://developer.apple.com/techpubs/macosx/Carbon/Files/FileManager/File_Man
>
> ager/Functions/Converting_B_f_Structures.html
>
>
>
> This might do what you are looking for (or at least help).
>
> Thanks,
>
> Jon
>
>
>
> -----Original Message-----
>
> From: email@hidden
>
> [mailto:email@hidden]On Behalf Of Patrick Tescher
>
> Sent: Tuesday, June 11, 2002 5:47 PM
>
> To: email@hidden
>
> Subject: CFURLRef -> NSFileManager path
>
>
>
>
>
> Is there an easy way to take a CFURLRef that points to a local file
>
> and turn
>
> it into a string that can be read by NSFilemanager so I could do
>
> something
>
> like fileExistsAtPath? I don't know anything about carbon and I would
>
> like
>
> to get back to cocoa as fast as possible :)
>
> _______________________________________________
>
> cocoa-dev mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
> Do not post admin requests to the list. They will be ignored.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.