• 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
NSPopUpButton failure after adding file names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPopUpButton failure after adding file names


  • Subject: NSPopUpButton failure after adding file names
  • From: Rick Anderson <email@hidden>
  • Date: Thu, 15 May 2003 03:25:58 -0700

I have an NSPopUpButton that I want to populate with the names of files in a specific directory on launch. I'm calling a function from awakeFromNib that handles this. The function that I wrote to do this appears to work (at least, it gets through the code without any apparent problem, but when it returns to awakeFromNib, the app dies "due to signal 11 (SIGSEGV)."

I'm not sure what I'm doing that is causing this. I temporarily rewrote the function and simply added the names of the files directly and it worked perfectly (I did this wondering if perhaps some character in the file names was causing problems since some of the names contained punctuation.) However, when it try to add them by actually enumerating through the files and adding the file names, then this failure occurs. And to reiterate: it doesn't happen within the function, but rather after the function returns.

Here's the function I wrote for adding the file names to the NSPopUpButton. Is there some subtle problem with what I'm doing here?



- (void)populateTemplateMenu
{
NSDirectoryEnumerator *theDirectory = [[NSFileManager defaultManager] enumeratorAtPath:@"templates/layouts/"];
NSMutableString *pathname = [[NSMutableString alloc] init];
NSMutableString *fullPath = [[NSMutableString alloc] init];

while (pathname = [theDirectory nextObject])
{
// establish the full path to the file
[fullPath setString: @"/Users/rick/Development/pf/build/templates/layouts/"];
[fullPath appendString: pathname];
// isFilePackageAtPath requires full path
if ( ([[NSWorkspace sharedWorkspace]isFilePackageAtPath:fullPath]) ||
([pathname isEqualToString:@".DS_Store"]) )
{
// skip any folders or bundles
[theDirectory skipDescendents];
}
else
{
// use the file name to build the layout menu
[storySectionMenu addItemWithTitle: pathname];
}
}

[theDirectory autorelease];
[pathname autorelease];
[fullPath autorelease];
}




--Rick Anderson
"The only difference between me and a madman
is that I am not mad." -- Salvador Dali
_______________________________________________
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.

  • Follow-Ups:
    • RE: NSPopUpButton failure after adding file names
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: NSPopUpButton failure after adding file names
      • From: Jyrki Wahlstedt <email@hidden>
  • Prev by Date: Path from a NSDictionary
  • Next by Date: Re: Best way to create custom DMG's
  • Previous by thread: Re: Path from a NSDictionary
  • Next by thread: Re: NSPopUpButton failure after adding file names
  • Index(es):
    • Date
    • Thread