SF.net SVN: geany:[4488] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Dec 9 13:29:09 UTC 2009


Revision: 4488
          http://geany.svn.sourceforge.net/geany/?rev=4488&view=rev
Author:   ntrel
Date:     2009-12-09 13:28:37 +0000 (Wed, 09 Dec 2009)

Log Message:
-----------
When going to a build error, try the current document's path if
the parsed filename doesn't exist. (This can happen when we receive
build messages in the wrong order - after the 'Leaving directory'
messages).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/msgwindow.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-12-09 12:59:34 UTC (rev 4487)
+++ trunk/ChangeLog	2009-12-09 13:28:37 UTC (rev 4488)
@@ -3,6 +3,11 @@
  * geany.glade, src/interface.c:
    Move 'Send Selection to Terminal' menu item from Format to Commands
    submenu.
+ * src/msgwindow.c:
+   When going to a build error, try the current document's path if
+   the parsed filename doesn't exist. (This can happen when we receive
+   build messages in the wrong order - after the 'Leaving directory'
+   messages).
 
 
 2009-12-08  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c	2009-12-09 12:59:34 UTC (rev 4487)
+++ trunk/src/msgwindow.c	2009-12-09 13:28:37 UTC (rev 4488)
@@ -610,10 +610,35 @@
 			find_prev_build_dir(path, model, &dir);
 			gtk_tree_path_free(path);
 			msgwin_parse_compiler_error_line(string, dir, &filename, &line);
+			g_free(dir);
 
-			if (dir != NULL)
-				g_free(dir);
+			/* If the path doesn't exist, try the current document.
+			 * This happens when we receive build messages in the wrong order - after the
+			 * 'Leaving directory' messages */
+			if (!g_file_test(filename, G_FILE_TEST_EXISTS))
+			{
+				gchar *cur_dir = utils_get_current_file_dir_utf8();
+				gchar *name;
 
+				if (cur_dir)
+				{
+					/* we let the user know we couldn't find the parsed filename from the message window */
+					setptr(cur_dir, utils_get_locale_from_utf8(cur_dir));
+					name = g_path_get_basename(filename);
+					setptr(name, g_build_path(G_DIR_SEPARATOR_S, cur_dir, name, NULL));
+					g_free(cur_dir);
+
+					if (g_file_test(name, G_FILE_TEST_EXISTS))
+					{
+						ui_set_statusbar(FALSE, _("Could not find file '%s' - trying the current document path."),
+							filename);
+						filename = name;
+					}
+					else
+						g_free(name);
+				}
+			}
+
 			if (filename != NULL && line > -1)
 			{
 				gchar *utf8_filename = utils_get_utf8_from_locale(filename);


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