mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
Bug 658772: Directory paths for resource directories are hard coded.
Provide dynamic path discovery functions as are provided for win32.
This commit is contained in:
parent
d172f1ce22
commit
6dc34c1f5e
@ -318,6 +318,11 @@ if test -z "$backend_set"; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(quartz-relocation,
|
||||||
|
[AS_HELP_STRING([--enable-quartz-relocation],
|
||||||
|
[enable bundle-based relocation functions])],
|
||||||
|
[quartz_relocation=yes])
|
||||||
|
|
||||||
cairo_backends=
|
cairo_backends=
|
||||||
backend_immodules=
|
backend_immodules=
|
||||||
GDK_BACKENDS=
|
GDK_BACKENDS=
|
||||||
@ -360,6 +365,10 @@ if test "x$enable_quartz_backend" = xyes; then
|
|||||||
#define GDK_WINDOWING_QUARTZ"
|
#define GDK_WINDOWING_QUARTZ"
|
||||||
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
|
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
|
||||||
AM_CONDITIONAL(USE_QUARTZ, true)
|
AM_CONDITIONAL(USE_QUARTZ, true)
|
||||||
|
if test "x$quartz_relocation" = xyes; then
|
||||||
|
AC_DEFINE([QUARTZ_RELOCATION], [1], [Use NSBundle functions to determine load paths for libraries, translations, etc.])
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
AM_CONDITIONAL(USE_QUARTZ, false)
|
AM_CONDITIONAL(USE_QUARTZ, false)
|
||||||
fi
|
fi
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#if defined G_OS_WIN32 \
|
||||||
|
|| (defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
|
||||||
|
|
||||||
const gchar *_gtk_get_datadir ();
|
const gchar *_gtk_get_datadir ();
|
||||||
const gchar *_gtk_get_libdir ();
|
const gchar *_gtk_get_libdir ();
|
||||||
|
@ -310,3 +310,71 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
|
|||||||
freeWhenDone:NO]
|
freeWhenDone:NO]
|
||||||
forType:type];
|
forType:type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bundle-based functions for various directories. These almost work
|
||||||
|
* even when the application isn't in a bundle, becuase mainBundle
|
||||||
|
* paths point to the bin directory in that case. It's a simple matter
|
||||||
|
* to test for that and remove the last element.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
get_bundle_path()
|
||||||
|
{
|
||||||
|
gchar *base, *path;
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
gchar *resource_path = g_strdup([[[NSBundle mainBundle] resourcePath] UTF8String]);
|
||||||
|
[pool drain];
|
||||||
|
base = g_path_get_basename(resource_path);
|
||||||
|
if (strcmp(base, "bin") == 0)
|
||||||
|
path = g_path_get_dirname(resource_path);
|
||||||
|
else
|
||||||
|
path = strdup(resource_path);
|
||||||
|
g_free(resource_path);
|
||||||
|
g_free(base);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
_gtk_get_datadir (void)
|
||||||
|
{
|
||||||
|
gchar *resource_dir = get_bundle_path();
|
||||||
|
gchar *retval = g_build_filename(resource_dir, "share", NULL);
|
||||||
|
g_free(resource_dir);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
_gtk_get_libdir (void)
|
||||||
|
{
|
||||||
|
gchar *resource_dir = get_bundle_path();
|
||||||
|
gchar *retval = g_build_filename(resource_dir, "lib", NULL);
|
||||||
|
g_free(resource_dir);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
_gtk_get_localedir (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
gchar *resource_dir = get_bundle_path();
|
||||||
|
gchar *retval = g_build_filename(resource_dir, "share", "locale", NULL);
|
||||||
|
g_free(resource_dir);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
_gtk_get_sysconfdir (void)
|
||||||
|
{
|
||||||
|
gchar *resource_dir = get_bundle_path();
|
||||||
|
gchar *retval = g_build_filename(resource_dir, "etc", NULL);
|
||||||
|
g_free(resource_dir);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
_gtk_get_data_prefix (void)
|
||||||
|
{
|
||||||
|
return get_bundle_path();
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user