• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOpenPanel Exception/Bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOpenPanel Exception/Bug


  • Subject: Re: NSOpenPanel Exception/Bug
  • From: Seth Willits <email@hidden>
  • Date: Tue, 28 Jul 2009 23:12:43 -0700


On Jul 28, 2009, at 9:56 PM, Andy Lee wrote:

On Jul 28, 2009, at 7:54 PM, Seth Willits wrote:
It works its way down to the last if statement which launches /usr/ bin/file to figure out the type of the file. It's all straight forward simple code, which simply returns YES or NO, but it's causing an exception apparently, and I don't see how I could do anything different.

Offhand it all looks pretty innocuous to me, but regarding that last part -- is fileTypeForFileAtPath: a category method you added? If so, can you show the code?


Yes. It just fires off a task.


- (NSString *)fileTypeForFileAtPath:(NSString *)filePath;
{
NSPipe * pipe = [[NSPipe alloc] init];
NSTask * task = [[NSTask alloc] init];
NSString * result;
NSData * data;


[task setLaunchPath:@"/usr/bin/file"];
[task setArguments:[NSArray arrayWithObjects:@"-b", filePath, nil]];
[task setStandardOutput:pipe];
[task launch];
[task waitUntilExit];

if ([task terminationStatus] != 0) {
result = nil;
goto bail;
}

data = [[pipe fileHandleForReading] availableData];
if (data == nil) {
result = nil;
goto bail;
}

result = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];

bail:
[pipe release];
[task release];
return result;
}




I'd file a bug report on the exception being thrown, but heck if I can reproduce it.


-- Seth Willits



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSOpenPanel Exception/Bug
      • From: Andy Lee <email@hidden>
    • Re: NSOpenPanel Exception/Bug
      • From: Kyle Sluder <email@hidden>
References: 
 >NSOpenPanel Exception/Bug (From: Seth Willits <email@hidden>)
 >Re: NSOpenPanel Exception/Bug (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: NSArrayController subclass computed property not being updated
  • Next by Date: Re: NSOpenPanel Exception/Bug
  • Previous by thread: Re: NSOpenPanel Exception/Bug
  • Next by thread: Re: NSOpenPanel Exception/Bug
  • Index(es):
    • Date
    • Thread