• 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 What to do? (I have a simple method for doing it)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE What to do? (I have a simple method for doing it)


  • Subject: RE What to do? (I have a simple method for doing it)
  • From: "Joshua D. Orr" <email@hidden>
  • Date: Fri, 22 Feb 2002 11:37:24 -0700

Here you go, this is a very simple an elegant solution!

while(pname = [direnum nextObject])
{

// This should work, it is documented in the NSDirectoryEnumerator
// And NSFileManager documention files...

if([[[direnum fileAttributes] fileType] isEqualToString:NSFileTypeRegular])

Table *nowy = [[Table alloc] init];
[nowy setIconCell:[[NSWorkspace sharedWorkspace] iconForFile:pname]];
[nowy setPathToFile:pname];
[nowy setFileExtension:[pname pathExtension]];
[nowy setFileName:[pname lastPathComponent]];
[fileSpecs addObject:nowy];
[nowy release];

[table reloadData];
}
}

Important Note:
NOTE: Please be aware that you did a if(!(pname = [direnum nextObject])) earlier, so you will have lost one file path before you get into the while loop! Do the following to fix this:

do
{

// This should work, it is documented in the NSDirectoryEnumerator
// And NSFileManager documention files...

if([[[direnum fileAttributes] fileType] isEqualToString:NSFileTypeRegular])

Table *nowy = [[Table alloc] init];
[nowy setIconCell:[[NSWorkspace sharedWorkspace] iconForFile:pname]];
[nowy setPathToFile:pname];
[nowy setFileExtension:[pname pathExtension]];
[nowy setFileName:[pname lastPathComponent]];
[fileSpecs addObject:nowy];
[nowy release];

[table reloadData];
}
}while (pname = [direnum nextObject])
_______________________________________________
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: RE What to do? (I have a simple method for doing it)
      • From: Lukasz Kuczborski <email@hidden>
    • Re: RE What to do? (I have a simple method for doing it)
      • From: Lukasz Kuczborski <email@hidden>
  • Prev by Date: Re: incompatible pointer type (was: Please help?
  • Next by Date: Re: variable arguments in ObjC
  • Previous by thread: Re: incompatible pointer type (was: Please help?)
  • Next by thread: Re: RE What to do? (I have a simple method for doing it)
  • Index(es):
    • Date
    • Thread