2
// Copyright 2011 Canonical Ltd.
4
// This program is free software: you can redistribute it and/or modify it
5
// under the terms of the GNU Affero General Public License version 3,
6
// as published by the Free Software Foundation.
8
// This program is distributed in the hope that it will be useful, but
9
// WITHOUT ANY WARRANTY; without even the implied warranties of
10
// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
// PURPOSE. See the GNU Affero General Public License for more details.
13
// You should have received a copy of the GNU Affero General Public License
14
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
#import "U1UTIMapper.h"
18
@interface U1UTIMapper ()
19
@property (retain) NSDictionary *mappings;
22
static U1UTIMapper *sharedU1UTIMapper = nil;
24
@implementation U1UTIMapper
28
+ (U1UTIMapper *)sharedU1UTIMapper;
30
if (sharedU1UTIMapper == nil)
32
sharedU1UTIMapper = [[self alloc] init];
34
return sharedU1UTIMapper;
42
self.mappings = [NSDictionary dictionaryWithContentsOfFile:
43
[[NSBundle mainBundle] pathForResource:@"uti-mappings" ofType:@"plist"]];
53
- (NSString *)humanReadableTypeForUTI:(NSString *)uti;
55
return [[self.mappings objectForKey:uti] objectForKey:@"type"];
58
- (NSString *)extensionForUTI:(NSString *)uti;
60
return [[self.mappings objectForKey:uti] objectForKey:@"extension"];
63
- (NSString *)MIMETypeForUTI:(NSString *)uti;
65
return [[self.mappings objectForKey:uti] objectForKey:@"mimetype"];