[gnome-builder] libide: Fix wrong file opened from build output
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: Fix wrong file opened from build output
- Date: Wed, 22 Jun 2022 20:00:11 +0000 (UTC)
commit ef16d1d69eac86dddb61a72ef2b29ad1b7cd17d9
Author: Michael Mera <dev michaelmera com>
Date: Wed Jun 22 21:37:12 2022 +0200
libide: Fix wrong file opened from build output
Builder offers the possibility to open a file from clicking a
warning/error message in the build output. However, when the path
clicked is relative and there is a file with the same name in the
project's source directory this file is opened, even if there is a
better match for the full path in the build directory.
This commit fixes such instances by looking for exact matches of the
full path in all the search roots (source directory and build directory)
before resorting to looking at the filename only.
Fixes #1687
src/libide/gui/ide-workbench.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 54cafdcaf..8da7c6e1b 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -2486,19 +2486,24 @@ ide_workbench_resolve_file_worker (IdeTask *task,
g_assert (rf->roots != NULL);
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
- basename = g_path_get_basename (rf->path);
-
for (guint i = 0; i < rf->roots->len; i++)
{
GFile *root = g_ptr_array_index (rf->roots, i);
g_autoptr(GFile) child = g_file_get_child (root, rf->path);
- g_autoptr(GPtrArray) found = NULL;
if (g_file_query_exists (child, cancellable))
{
ide_task_return_pointer (task, g_steal_pointer (&child), g_object_unref);
return;
}
+ }
+
+ basename = g_path_get_basename (rf->path);
+
+ for (guint i = 0; i < rf->roots->len; i++)
+ {
+ GFile *root = g_ptr_array_index (rf->roots, i);
+ g_autoptr(GPtrArray) found = NULL;
found = ide_g_file_find_with_depth (root, basename, 0, cancellable);
IDE_PTR_ARRAY_SET_FREE_FUNC (found, g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]