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.
22 #include <glib/gstrfuncs.h>
27 #include <AppKit/AppKit.h>
29 static char *bundle_resource_path = NULL;
30 static char *bundle_plugin_path = NULL;
31 static char *user_data_path = NULL;
33 static char *get_bundle_resource_path()
35 if( bundle_resource_path == NULL ) {
36 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
37 NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
38 bundle_resource_path = strdup([resourcePath UTF8String]);
41 return bundle_resource_path;
44 const char *get_sysconf_path()
46 return get_bundle_resource_path();
49 const char *get_locale_path()
51 return get_bundle_resource_path();
54 const char *get_plugin_path()
56 if( bundle_plugin_path == NULL ) {
57 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
58 NSString *pluginPath = [[NSBundle mainBundle] builtInPlugInsPath];
59 bundle_plugin_path = strdup([pluginPath UTF8String]);
62 return bundle_plugin_path;
66 const char *get_user_data_path()
68 if( user_data_path == NULL ) {
69 char *home = getenv("HOME");
70 user_data_path = g_strdup_printf( "%s/Library/Application Support/Lxdream", home );
72 return user_data_path;
.