Under linux, try to locate the file with the given
name also under /usr/local/include and /usr/include.
This feature is probably most often used for
opening include files so this helps for the system
ones.

Signed-off-by: Jiří Techet <[email protected]>
---
 src/callbacks.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/callbacks.c b/src/callbacks.c
index f973570..998018b 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -485,7 +485,7 @@ on_reload_as_activate                  (GtkMenuItem     *menuitem,
 		charset = doc->encoding;
 
 	base_name = g_path_get_basename(doc->file_name);
-	if (!doc->changed || 
+	if (!doc->changed ||
 		dialogs_show_question_full(NULL, _("_Reload"), GTK_STOCK_CANCEL,
 		_("Any unsaved changes will be lost."),
 		_("Are you sure you want to reload '%s'?"), base_name))
@@ -1840,10 +1840,18 @@ on_menu_open_selected_file1_activate   (GtkMenuItem     *menuitem,
 				setptr(filename, g_build_path(G_DIR_SEPARATOR_S, path, sel, NULL));
 			}
 			g_free(path);
+#ifdef G_OS_UNIX
+			if (! g_file_test(filename, G_FILE_TEST_EXISTS))
+				setptr(filename, g_build_path(G_DIR_SEPARATOR_S, "/usr/local/include", sel, NULL));
+
+			if (! g_file_test(filename, G_FILE_TEST_EXISTS))
+				setptr(filename, g_build_path(G_DIR_SEPARATOR_S, "/usr/include", sel, NULL));
+#endif
 		}
 
 		locale_filename = utils_get_locale_from_utf8(filename);
-		document_open_file(locale_filename, FALSE, NULL, NULL);
+		if (g_file_test(filename, G_FILE_TEST_EXISTS))
+			document_open_file(locale_filename, FALSE, NULL, NULL);
 
 		g_free(filename);
 		g_free(locale_filename);
_______________________________________________
Geany-devel mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

Reply via email to