2016-07-21 1 views

Répondre

0

Vous pouvez l'utiliser. Cela obtiendra le «genre» du fichier.

- (NSString *)humanReadableFileType:(NSString *)path 
{ 
    NSString *kind = nil; 
    NSURL *url = [NSURL fileURLWithPath:[path stringByExpandingTildeInPath]]; 
    LSCopyKindStringForURL((CFURLRef)url, (CFStringRef *)&kind); 
    return kind ? [kind autorelease] : @""; 
} 

Après que l'enregistrement comme ça

if([kind isEqualToString:@"ppt"]) 
{ 

} 

Source: http://importantshock.wordpress.com/2007/01/07/cocoa-snippet-finding-a-files-kind/#post-19