| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
|
| 21 |
#include "gtkprivate.h" |
| 22 |
|
| 23 |
#include <gdk/macos/gdkmacos.h> |
| 24 |
|
| 25 |
#ifdef QUARTZ_RELOCATION |
| 26 |
|
| 27 |
|
| 28 |
le |
| 29 |
er |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
static const char * |
| 34 |
get_bundle_path (void) |
| 35 |
{ |
| 36 |
static char *path = NULL; |
| 37 |
|
| 38 |
if (path == NULL) |
| 39 |
{ |
| 40 |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
| 41 |
char *resource_path = g_strdup ([[[NSBundle mainBundle] resourcePath] UTF8String]); |
| 42 |
char *base; |
| 43 |
[pool drain]; |
| 44 |
|
| 45 |
base = g_path_get_basename (resource_path); |
| 46 |
if (strcmp (base, "bin") == 0) |
| 47 |
path = g_path_get_dirname (resource_path); |
| 48 |
else |
| 49 |
path = strdup (resource_path); |
| 50 |
|
| 51 |
g_free (resource_path); |
| 52 |
g_free (base); |
| 53 |
} |
| 54 |
|
| 55 |
return path; |
| 56 |
} |
| 57 |
|
| 58 |
const char * |
| 59 |
_gtk_get_datadir (void) |
| 60 |
{ |
| 61 |
static char *path = NULL; |
| 62 |
|
| 63 |
if (path == NULL) |
| 64 |
path = g_build_filename (get_bundle_path (), "share", NULL); |
| 65 |
|
| 66 |
return path; |
| 67 |
} |
| 68 |
|
| 69 |
const char * |
| 70 |
_gtk_get_libdir (void) |
| 71 |
{ |
| 72 |
static char *path = NULL; |
| 73 |
|
| 74 |
if (path == NULL) |
| 75 |
path = g_build_filename (get_bundle_path (), "lib", NULL); |
| 76 |
|
| 77 |
return path; |
| 78 |
} |
| 79 |
|
| 80 |
const char * |
| 81 |
_gtk_get_localedir (void) |
| 82 |
{ |
| 83 |
static char *path = NULL; |
| 84 |
|
| 85 |
if (path == NULL) |
| 86 |
path = g_build_filename (get_bundle_path (), "share", "locale", NULL); |
| 87 |
|
| 88 |
return path; |
| 89 |
} |
| 90 |
|
| 91 |
const char * |
| 92 |
_gtk_get_sysconfdir (void) |
| 93 |
{ |
| 94 |
static char *path = NULL; |
| 95 |
|
| 96 |
if (path == NULL) |
| 97 |
path = g_build_filename (get_bundle_path (), "etc", NULL); |
| 98 |
|
| 99 |
return path; |
| 100 |
} |
| 101 |
|
| 102 |
const char * |
| 103 |
_gtk_get_data_prefix (void) |
| 104 |
{ |
| 105 |
return get_bundle_path (); |
| 106 |
} |
| 107 |
|
| 108 |
#endif |