[evolution-data-server] [Win32] Try to find subprefix when replacing runtime prefix



commit 14450513cc031cdd6076dde13cfec375b198f769
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 13 20:13:17 2015 +0100

    [Win32] Try to find subprefix when replacing runtime prefix
    
    This is used for evolution plugins, where an .eplug file contains
    Unix-like path, instead of Windows-like full path.

 libedataserver/e-data-server-util.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index 6d7ee7f..5d1c7be 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -1708,10 +1708,38 @@ e_util_replace_prefix (const gchar *configure_time_prefix,
        c_t_prefix_slash = g_strconcat (configure_time_prefix, "/", NULL);
 
        if (runtime_prefix &&
+           !g_str_has_prefix (configure_time_path, c_t_prefix_slash)) {
+               gint ii;
+               gchar *path;
+
+               path = g_strdup (configure_time_path);
+
+               for (ii = 0; ii < 3; ii++) {
+                       const gchar *pos;
+                       gchar *last_slash;
+
+                       last_slash = strrchr (path, '/');
+                       if (!last_slash)
+                               break;
+
+                       *last_slash = '\0';
+
+                       pos = strstr (configure_time_prefix, path);
+                       if (pos && pos[strlen(path)] == '/') {
+                               g_free (c_t_prefix_slash);
+                               c_t_prefix_slash = g_strconcat (configure_time_prefix + (pos - 
configure_time_prefix), "/", NULL);
+                               break;
+                       }
+               }
+
+               g_free (path);
+       }
+
+       if (runtime_prefix &&
            g_str_has_prefix (configure_time_path, c_t_prefix_slash)) {
                retval = g_strconcat (
                        runtime_prefix,
-                       configure_time_path + strlen (configure_time_prefix),
+                       configure_time_path + strlen (c_t_prefix_slash) - 1,
                        NULL);
        } else
                retval = g_strdup (configure_time_path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]