RE What to do? (I have a simple method for doing it)
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.