Le 15/03/2013 16:18, Nick Treleaven a écrit :
> On 13/03/2013 06:19, Lex Trotman wrote:
>> Shouldn't plugins use geany->app->configdir as the base directory as
>> perhttp://www.geany.org/manual/reference/structGeanyApp.html
>>
>> and if its Geany it can use GeanyApp.datadir as the system data
>> directory.
>>
>>
>>   For this to work, the working
>>> >directory must be set correctly. The reason for the mentioned change
>>> was
>>> >this in some plugin, so I've moved the code to change the working
>>> >directory to perform it earlier in the init process, before loading
>>> plugins.
>>> >For a quick'n'dirty fix we could either move the working directory
>>> >change code move after command line parsing code but before plugin
>>> >loading or we remember the working directory at early stage to use this
>>> >when llater handling command line arguments.
>>> >Both are not nice and the real solution is to get rid of relative paths
>>> >for resources in the installation directory.
>>> >I'm going to work on this.
>> Yes it would be better to keep the working dir, ... well ... the
>> working dir:)
> 
> +1, it's best for plugins to use fixed paths and avoid temporarily
> changing the working dir.

Agreed.  Though, IIUC on Windows it's meant to be dynamic, so it'd
require an API the plugins could use to get the sysdir -- or make all
plugins use g_win32_get_package_installation_directory_of_module() but
it's tedious.

BTW if we want not to change directory anymore, I think we'd need the
attached (untested) patch which fixes the only location I found where
Geany uses relative paths.  Or even apply it now (if it is tested
working) so we don't have relative path ourselves anymore.
>From 32023595d4bec8be5033fa7cc5abebd8fe1c02a9 Mon Sep 17 00:00:00 2001
From: Colomban Wendling <b...@herbesfolles.org>
Date: Sat, 16 Mar 2013 18:08:51 +0100
Subject: [PATCH] Windows: use absolute path to the icons directory

---
 src/main.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main.c b/src/main.c
index e7867c6..705a213 100644
--- a/src/main.c
+++ b/src/main.c
@@ -228,13 +228,16 @@ static void apply_settings(void)
 static void main_init(void)
 {
 	/* add our icon path in case we aren't installed in the system prefix */
-#ifndef G_OS_WIN32
-	gchar *path = g_build_filename(GEANY_DATADIR, "icons", NULL);
-	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), path);
-	g_free(path);
+	gchar *path;
+#ifdef G_OS_WIN32
+	gchar *install_dir = win32_get_installation_dir();
+	path = g_build_filename(install_dir, "share", "icons", NULL);
+	g_free(install_dir);
 #else
-	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), "share\\icons");
+	path = g_build_filename(GEANY_DATADIR, "icons", NULL);
 #endif
+	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), path);
+	g_free(path);
 
 	/* inits */
 	ui_init_stock_items();
-- 
1.7.10.4

_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

Reply via email to