[gnome-builder/gnome-builder-3-32] editor: resolve symlink before performing lookup
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-32] editor: resolve symlink before performing lookup
- Date: Wed, 27 Mar 2019 02:13:05 +0000 (UTC)
commit 9bce30fa6a8dc499219a4bb40478f56417ba823c
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 26 18:59:58 2019 -0700
editor: resolve symlink before performing lookup
This resolves the symlink before we continue to lookup any
existing window. This is useful when we have an installation
that contains symlinks somewhere in the home directory or
path to the project.
src/libide/editor/ide-editor-surface.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-surface.c b/src/libide/editor/ide-editor-surface.c
index 278fd8b3f..2d1507ae9 100644
--- a/src/libide/editor/ide-editor-surface.c
+++ b/src/libide/editor/ide-editor-surface.c
@@ -23,8 +23,12 @@
#include "config.h"
#include <glib/gi18n.h>
+#include <libide-io.h>
#include <libide-code.h>
+#include "ide-buffer-private.h"
+#include "ide-gfile-private.h"
+
#include "ide-editor-addin.h"
#include "ide-editor-surface.h"
#include "ide-editor-private.h"
@@ -608,7 +612,6 @@ ide_editor_surface_find_source_location (GtkWidget *widget,
IdeEditorPage *page;
} *lookup = user_data;
IdeBuffer *buffer;
- GFile *file;
g_return_if_fail (IDE_IS_PAGE (widget));
@@ -619,9 +622,8 @@ ide_editor_surface_find_source_location (GtkWidget *widget,
return;
buffer = ide_editor_page_get_buffer (IDE_EDITOR_PAGE (widget));
- file = ide_buffer_get_file (buffer);
- if (g_file_equal (file, lookup->file))
+ if (_ide_buffer_is_file (buffer, lookup->file))
lookup->page = IDE_EDITOR_PAGE (widget);
}
@@ -662,10 +664,11 @@ cleanup:
}
static void
-ide_editor_surface_focus_location_full (IdeEditorSurface *self,
- IdeLocation *location,
- gboolean open_if_not_found)
+ide_editor_surface_focus_location_full (IdeEditorSurface *self,
+ IdeLocation *location,
+ gboolean open_if_not_found)
{
+ g_autoptr(GFile) translated = NULL;
struct {
GFile *file;
IdeEditorPage *page;
@@ -679,7 +682,10 @@ ide_editor_surface_focus_location_full (IdeEditorSurface *self,
g_assert (IDE_IS_EDITOR_SURFACE (self));
g_assert (location != NULL);
- lookup.file = ide_location_get_file (location);
+ /* Remove symlinks to increase chance we find a match */
+ translated = _ide_g_file_readlink (ide_location_get_file (location));
+
+ lookup.file = translated;
lookup.page = NULL;
if (lookup.file == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]