SF.net SVN: geany: [1990] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Oct 29 17:15:05 UTC 2007


Revision: 1990
          http://geany.svn.sourceforge.net/geany/?rev=1990&view=rev
Author:   ntrel
Date:     2007-10-29 10:15:03 -0700 (Mon, 29 Oct 2007)

Log Message:
-----------
Don't dereference symlinks.
Make sure current_dir always has a full path.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/filebrowser.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-10-29 16:53:40 UTC (rev 1989)
+++ trunk/ChangeLog	2007-10-29 17:15:03 UTC (rev 1990)
@@ -15,6 +15,9 @@
    Disable project menu item when no project is open.
  * src/document.c:
    Make Fold All/Unfold All attempt to scroll the current line in view.
+ * plugins/filebrowser.c:
+   Don't dereference symlinks.
+   Make sure current_dir always has a full path.
 
 
 2007-10-28  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/plugins/filebrowser.c
===================================================================
--- trunk/plugins/filebrowser.c	2007-10-29 16:53:40 UTC (rev 1989)
+++ trunk/plugins/filebrowser.c	2007-10-29 17:15:03 UTC (rev 1990)
@@ -153,9 +153,6 @@
 
 	clear();
 
-	// TODO: really, we don't want to dereference symlinks
-	setptr(current_dir, tagm->get_real_path(current_dir));
-
 	utf8_dir = utils->get_utf8_from_locale(current_dir);
 	gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir);
 	g_free(utf8_dir);
@@ -170,21 +167,29 @@
 }
 
 
+static void on_go_home()
+{
+	setptr(current_dir, g_strdup(g_get_home_dir()));
+	refresh();
+}
+
+
 static void on_current_path()
 {
 	gchar *fname;
 	gchar *dir;
 	gint idx = documents->get_cur_idx();
 
-	if (DOC_IDX_VALID(idx))
+	if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL ||
+		! g_path_is_absolute(doc_list[idx].file_name))
 	{
-		fname = DOC_FILENAME(idx);
-		fname = utils->get_locale_from_utf8(fname);
-		dir = g_path_get_dirname(fname);
-		g_free(fname);
+		on_go_home();
+		return;
 	}
-	else
-		dir = g_strdup(".");
+	fname = doc_list[idx].file_name;
+	fname = utils->get_locale_from_utf8(fname);
+	dir = g_path_get_dirname(fname);
+	g_free(fname);
 
 	setptr(current_dir, dir);
 	refresh();
@@ -331,16 +336,10 @@
 }
 
 
-static void on_go_home()
-{
-	setptr(current_dir, g_strdup(g_get_home_dir()));
-	refresh();
-}
-
-
 static void on_go_up()
 {
-	setptr(current_dir, g_build_path(G_DIR_SEPARATOR_S, current_dir, "..", NULL));
+	// remove the highest directory part (which becomes the basename of current_dir)
+	setptr(current_dir, g_path_get_dirname(current_dir));
 	refresh();
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list