[anjuta] Save the project directory as a relative path



commit df82c7ff073a23112b45f865c78edf43886d7f0c
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sat Oct 12 15:04:46 2013 +0200

    Save the project directory as a relative path
    
    Previously, the project directory was stored relatively to the parent directory
    of the project and not the project directory

 libanjuta/anjuta-session.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/libanjuta/anjuta-session.c b/libanjuta/anjuta-session.c
index 8b0d616..6475d2a 100644
--- a/libanjuta/anjuta-session.c
+++ b/libanjuta/anjuta-session.c
@@ -480,7 +480,7 @@ anjuta_session_get_relative_uri_from_file (AnjutaSession *session,
        gint level;
 
        parent = g_file_new_for_path (session->priv->dir_path);
-       for (level = 0; (parent != NULL) && !g_file_has_prefix (file, parent); level++)
+       for (level = 0; (parent != NULL) && !g_file_equal (file, parent) && !g_file_has_prefix (file, 
parent); level++)
        {
                GFile *next = g_file_get_parent (parent);
                g_object_unref (parent);
@@ -495,9 +495,16 @@ anjuta_session_get_relative_uri_from_file (AnjutaSession *session,
        {
                gchar *path;
 
-               path = g_file_get_relative_path (parent, file);
-               uri = g_uri_escape_string (path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
-               g_free (path);
+               if (g_file_equal (file, parent))
+               {
+                       uri = g_strdup(".");
+               }
+               else
+               {
+                       path = g_file_get_relative_path (parent, file);
+                       uri = g_uri_escape_string (path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
+                       g_free (path);
+               }
                if (level != 0)
                {
                        gsize len;


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