Branch: refs/heads/master Author: Enrico Troeger enrico.troeger@uvena.de Committer: Enrico Troeger enrico.troeger@uvena.de Date: Sun, 03 Mar 2013 22:33:25 UTC Commit: 775ef628688c69de34640e12666aed5762a80dff https://github.com/geany/geany/commit/775ef628688c69de34640e12666aed5762a80d...
Log Message: ----------- Set the working directory on Windows very early to also help code which uses relative resource paths
Modified Paths: -------------- src/main.c
Modified: src/main.c 25 files changed, 14 insertions(+), 11 deletions(-) =================================================================== @@ -376,6 +376,18 @@ static void get_line_and_column_from_filename(gchar *filename, gint *line, gint }
+#ifdef G_OS_WIN32 +static void change_working_directory_on_windows(const gchar *install_dir) +{ + /* On Windows, change the working directory to the Geany installation path to not lock + * the directory of a file passed as command line argument (see bug #2626124). + * This also helps if plugins or other code uses relative paths to load + * any additional resources (e.g. share/geany-plugins/...). */ + win32_set_working_directory(install_dir); +} +#endif + + static void setup_paths(void) { gchar *data_dir; @@ -390,6 +402,8 @@ static void setup_paths(void) data_dir = g_build_filename(install_dir, "data", NULL); /* e.g. C:\Program Files\geany\data */ doc_dir = g_build_filename(install_dir, "doc", NULL);
+ change_working_directory_on_windows(install_dir); + g_free(install_dir); #else data_dir = g_build_filename(GEANY_DATADIR, "geany", NULL); /* e.g. /usr/share/geany */ @@ -1143,17 +1157,6 @@ gint main(gint argc, gchar **argv) } #endif
-#ifdef G_OS_WIN32 - { - gchar *dir; - /* On Windows, change the working directory to the Geany installation path to not lock - * the directory of a file passed as command line argument (see bug #2626124). */ - dir = win32_get_installation_dir(); - win32_set_working_directory(dir); - g_free(dir); - } -#endif - /* when we are really done with setting everything up and the main event loop is running, * tell other components, mainly plugins, that startup is complete */ g_idle_add_full(G_PRIORITY_LOW, send_startup_complete, NULL, NULL);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).