[gtk/matthiasc/for-master] Avoid adding // to resource paths
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] Avoid adding // to resource paths
- Date: Sat, 12 Dec 2020 02:49:06 +0000 (UTC)
commit aeca9cb7baa8ef044723c60a1bfcb1a4aa27fa3c
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Dec 11 21:47:54 2020 -0500
Avoid adding // to resource paths
The GResource machinery is not forgiving about this
sort of thing.
Fixes: #3469
gtk/gtkapplication.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 7b438f1581..e3e4401ff5 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -191,19 +191,23 @@ gtk_application_load_resources (GtkApplication *application)
{
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
const char *base_path;
+ const char *optional_slash = "/";
base_path = g_application_get_resource_base_path (G_APPLICATION (application));
if (base_path == NULL)
return;
+ if (base_path[strlen (base_path) - 1] == '/')
+ optional_slash = "";
+
/* Expand the icon search path */
{
GtkIconTheme *default_theme;
char *iconspath;
default_theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
- iconspath = g_strconcat (base_path, "/icons/", NULL);
+ iconspath = g_strconcat (base_path, optional_slash, "icons/", NULL);
gtk_icon_theme_add_resource_path (default_theme, iconspath);
g_free (iconspath);
}
@@ -212,7 +216,7 @@ gtk_application_load_resources (GtkApplication *application)
{
char *menuspath;
- menuspath = g_strconcat (base_path, "/gtk/menus.ui", NULL);
+ menuspath = g_strconcat (base_path, optional_slash, "gtk/menus.ui", NULL);
if (g_resources_get_info (menuspath, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
priv->menus_builder = gtk_builder_new_from_resource (menuspath);
g_free (menuspath);
@@ -231,7 +235,7 @@ gtk_application_load_resources (GtkApplication *application)
{
char *path;
- path = g_strconcat (base_path, "/gtk/help-overlay.ui", NULL);
+ path = g_strconcat (base_path, optional_slash, "gtk/help-overlay.ui", NULL);
if (g_resources_get_info (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
{
const char * const accels[] = { "<Control>question", NULL };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]