Re: Two questions
Re: Two questions
- Subject: Re: Two questions
- From: Aki Inoue <email@hidden>
- Date: Mon, 28 May 2001 01:29:15 -0700
status = FSPathMakeRef([fileName cString],&pathRef,&IsDirectory);
Unfortunately, this is incorrect. It won't work with any high-bit
characters & could raise exception in certain cases.
FSPathMakeRef (& all BSD API) in Mac OS X takes filenames in decomposed
UTF-8.
In order to get filenames from NSString, you can use -[NSString
filesystemRepresentation] method.
In fact, Apple's suggesting to avoid the usage of -cString API as much
as possible to make your application Unicode-savy.
-cString API could make your application limited to single script.
For overriding the click-through behavior, you can override
-(BOOL)acceptsFirstMouse:(NSEvent *)theEvent; method in your control.
The default implementation of this method is designed to match the HIG.
Aki Inoue
Apple Computer Inc
Object App Framework
On 2001.05.27, at 10:37, David Adalsteinsson wrote:
For one app that I am working on, I have to use a Carbon call that
doesn't exist in Cocoa. Is there something that will convert a file
path NSString like I get from an NSOpenPanel to an FSRef? If there is
such a thing, could you also tell me what header the call is in?
FSSpec mySpec;
FSRef pathRef;
OSStatus status;
OSErr err
BOOL IsDirectory = NO;
// Construct the FSRef
status = FSPathMakeRef([fileName cString],&pathRef,&IsDirectory);
if (status==fnfErr) {
.....
}
// Convert FSRef to FSSpec if needed
err = FSGetCatalogInfo(&pathRef, kFSCatInfoNone, NULL, NULL,
&mySpec, NULL);
if (err) {
....
}
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev