Tizen 2.1 base
[external/enchant.git] / src / enchant_cocoa.m
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* enchant
3  * Copyright (C) 2004 Francis James Franklin
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, Dom Lachowicz
21  * gives permission to link the code of this program with
22  * non-LGPL Spelling Provider libraries (eg: a MSFT Office
23  * spell checker backend) and distribute linked combinations including
24  * the two.  You must obey the GNU Lesser General Public License in all
25  * respects for all of the code used other than said providers.  If you modify
26  * this file, you may extend this exception to your version of the
27  * file, but you are not obligated to do so.  If you do not wish to
28  * do so, delete this exception statement from your version.
29  */
30
31 #import "enchant_cocoa.h"
32
33 static EnchantResourceProvider * s_instance = 0;
34
35 @implementation EnchantResourceProvider
36
37 + (EnchantResourceProvider *)instance
38 {
39         if (!s_instance)
40                 {
41                         s_instance = [[EnchantResourceProvider alloc] init];
42                 }
43         return s_instance;
44 }
45
46 - (id)init
47 {
48         if (self = [super init])
49                 {
50                         ModuleFolder = [[NSBundle bundleForClass:[self class]] resourcePath];
51                         [ModuleFolder retain];
52
53                         ConfigFolder = [[NSString alloc] initWithUTF8String:"/Library/Application Support/Enchant"];
54                 }
55         return self;
56 }
57
58 - (void)dealloc
59 {
60         if (ModuleFolder)
61                 {
62                         [ModuleFolder release];
63                         ModuleFolder = 0;
64                 }
65         if (ConfigFolder)
66                 {
67                         [ConfigFolder release];
68                         ConfigFolder = 0;
69                 }
70         [super dealloc];
71 }
72
73 - (const char *)moduleFolder
74 {
75         return [ModuleFolder UTF8String];
76 }
77
78 - (const char *)configFolder
79 {
80         return [ConfigFolder UTF8String];
81 }
82
83 @end