4 * Cocoa builds need to use different paths from ordinary builds, since
5 * the message catalogs, default config, etc are all bundle-relative.
6 * Otherwise paths use the standard unix install paths
8 * Copyright (c) 2008 Nathan Keynes.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
25 #include <AppKit/AppKit.h>
27 static char *bundle_resource_path = NULL;
28 static char *bundle_plugin_path = NULL;
30 static char *get_bundle_resource_path()
32 if( bundle_resource_path == NULL ) {
33 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
34 NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
35 bundle_resource_path = strdup([resourcePath UTF8String]);
38 return bundle_resource_path;
41 const char *get_sysconf_path()
43 return get_bundle_resource_path();
46 const char *get_locale_path()
48 return get_bundle_resource_path();
51 const char *get_plugin_path()
53 if( bundle_plugin_path == NULL ) {
54 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
55 NSString *pluginPath = [[NSBundle mainBundle] builtInPlugInsPath];
56 bundle_plugin_path = strdup([pluginPath UTF8String]);
59 return bundle_plugin_path;
.