ファイルの属性を取得するときは
fileAttributesAtPath:traverseLink: ではなく、
attributesOfItemAtPath:error: を使う!
こんな感じで。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *attributes; NSString *cellIdentifier = [fileList objectAtIndex:[indexPath indexAtPosition:1]]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; /* text setting */ cell.textLabel.text = cellIdentifier; /* fonts setting */ UIFont *font = [[UIFont fontWithName:@"Times New Roman" size:12.0f] retain]; cell.textLabel.font = font; /* If directory, append UITableViewAccessoryDetailDisclosureButton */ attributes = [[NSFileManager defaultManager] attributesOfItemAtPath: [NSString stringWithFormat:@"%@/%@", self.currentDirectory, cellIdentifier] error:NULL]; NSLog(@"%@", attributes); if ([[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]) { cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; } } return cell; }
昔のメソッド名の方が短くていい名前><