[anjuta] build-basic-autotools: bgo#686911 - Path of Vala source files passed to message pane is wrong



commit 6224d0e5d7c5808e6292f60eff62978930b57f98
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Nov 11 16:24:24 2012 +0100

    build-basic-autotools: bgo#686911 - Path of Vala source files passed to message pane is wrong

 plugins/build-basic-autotools/plugin.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index 576947a..ab23d02 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -858,6 +858,29 @@ on_build_mesg_format (IAnjutaMessageView *view, const gchar *one_line,
 		{
 			mid_str = g_build_filename (build_context_get_dir (context, "default"),
 										dummy_fn, NULL);
+
+			/* If the file does not exist, try to replace the build directory by
+			 * the source directory. This is needed by the Vala compiler which
+			 * does not output absolute paths. */
+			if (!g_file_test (mid_str,G_FILE_TEST_IS_REGULAR))
+			{
+				GFile *file = g_file_new_for_path (mid_str);
+
+				if ((p->project_build_dir != NULL) && g_file_has_prefix (file, p->project_build_dir))
+				{
+					/* Try using the source directory */
+					gchar *relative;
+
+					relative = g_file_get_relative_path (p->project_build_dir, file);
+					g_object_unref (file);
+					file = g_file_get_child (p->project_root_dir, relative);
+					g_free (relative);
+
+					g_free (mid_str);
+					mid_str = g_file_get_path (file);
+				}
+				g_object_unref (file);
+			}
 		}
 		DEBUG_PRINT ("mid_str: %s", mid_str);
 



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